#include<bits/stdc++.h>
using namespace std;
const long long ttt=31622;
long long Pow(long long a,long long b)
{
long long ret=a,sum=1;
while(b!=1)
{
if(b%2==0)
{
if(ret>ttt) return -1;
ret*=ret;
b/=2;
}
else
{
sum*=ret;
b--;
}
}
if(sum*ret>1e9||sum*ret<-1) return -1;
return sum*ret;
}
int main()
{
freopen("csp2022pj_pow.in","r",stdin);
freopen("csp2022pj_pow.out","w",stdout);
long long a,b;
scanf("%lld%lld",&a,&b);
cout<<Pow(a,b);
return 0;
}