#include <bits/stdc++.h> using namespace std; int main() { int a,b; cin>>a>>b; int c=pow(a,b); if(c>1e9){ cout<<-1; }else{ cout<<c; } return 0; }