#include <bits/stdc++.h>
using namespace std;
#define int long long
#define MAX 1000000000
int a,b;
int fast_power(int x,int y) {
int ans = 1;
while(y > 0) {
if(y & 1) {
ans = ans * x;
if(ans > MAX) return -1;
}
x = x * x;
if(ans > MAX) return -1;
y >>= 1;
}
if(ans > MAX) return -1;
return ans;
}
signed main() {
cin >> a >> b;
cout << fast_power(a,b) << endl;
return 0;
}
有3个点错了