#include<bits/stdc++.h>
using namespace std;
unsigned long long a, b, s;
int main() {
freopen("csp2022pj_pow.in", "r", stdin);
freopen("csp2022pj_pow.out", "w", stdout);
cin >> a >> b;
s = a;
if (a == 1) {
cout << 1 ;
return 0;
}
if (b > 32) {
cout << -1;
return 0;
}
for (unsigned long long i = 2; i <= b; i++) {
s *= a;
if (s > 1e9) {
cout << -1;
return 0;
}
}
cout << s;
fclose(stdin);
fclose(stdout);
return 0;
}