#include <iostream>
#include <cmath>
using namespace std;
long long ans = 1;
const int MAX = 1e9;
int main(){
long long a;
long long b;
cin >> a >> b;
if(a == 1){
cout << 1;
return 0;
}
for (int i = 1; i <= b; i ++ ){
ans *= a;
if(ans > MAX){
cout << -1;
return 0;
}
}
cout << ans;
return 0;
}