#include<bits/stdc++.h>
using namespace std;
const unsigned long long N=1e9;
unsigned long long qpow(unsigned long long a,unsigned long long b){
if(b==1)return a;
if(b%2==0){
unsigned long long t=qpow(a,b/2);
return t*t;
}
return qpow(a,b-1)*a;
}
unsigned long long a,b,x;
int main(){
freopen("csp2022pj_pow.in","r",stdin);
freopen("csp2022pj_pow.out","w",stdout);
cin>>a>>b;
if(a>N||b>N){
cout<<-1;
return 0;
}
x=qpow(a,b);
if(x<=0||x>N)cout<<-1;
else cout<<x;
return 0;
}