#include<bits/stdc++.h>
#define int long long
using namespace std;
int qpow(int base,int p){
int ans=1,tmp=base;
while(p){
if(p&1){
if(1e9<ans*tmp)return -1;
ans*=tmp;
}
if(tmp>31622)return -1;
tmp*=tmp;
p>>=1;
}
return ans>1e9?-1:ans;
}
signed main(){
int a,b;cin>>a>>b;
if(a==1){
cout<<1;
return 0;
}
if(a>10&&b>=9){
cout<<-1<<endl;return 0;
}
cout<<qpow(a,b)<<endl;
}
60pts,原因未知,求大佬解答