#include<iostream>
using namespace std;
int x,y;
long long Pow(int a,int b){
long long ans=1,base=a;
while(b>0){
if(b&1){
ans*=base;
}
base*=base;
b>>=1;
}
return ans;
}
int main(){
cin>>x>>y;
if(Pow(x,y)>1000000000){
cout<<-1;
}
else{
cout<<Pow(x,y);
}
return 0;
}