#include<bits/stdc++.h>
using namespace std;
int n,m,cnt=0;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
std::cin>>n>>m;
if(pow(n,m)>2147483647){
std::cout<<"-1"<<endl;
}
else{
cnt=pow(n,m);
}
std::cout<<cnt<<endl;
return 0;
}