#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int p = 1e9;
LL a, b;
LL ksm(LL x, LL a){
LL ans = 1;
while(a){
if(a & 1) ans *= x;
a >>= 1;
x *= x;
if(x > p || ans > p) return -1;
}
return ans;
}
int main(){
cin >> a >> b;
cout << ksm(a, b) << endl;
return 0;
}
rt