#include<bits/stdc++.h>
using namespace std;
const int maxn=1000000000;
long long ksm(int x,int y){
if(y==1)return x;
y/=2;
if(y%2==0){
long long a=ksm(x,y);
if(a==-1)return -1;
if(a*a>maxn)return -1;
else return a*a;
}
if(y%2==1){
long long a=ksm(x,y);
if(a==-1)return -1;
if((a*a)*x>maxn)return -1;
else return (a*a)*x;
}
}
int main(){
long long a,b;
cin>>a>>b;
cout<<ksm(a,b);
return 0;
}
啊啊啊啊啊啊啊