#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n, m;
ll c = 1;
int main ()
{
freopen("csp2022pj_pow.in", "r", stdin);
freopen("csp2022pj_pow.out", "w", stdout);
cin >> n >> m;
if (n / 1000000000 >= 1 || m / 1000000000 >= 1) {
cout << -1;
return 0;
}
for (ll i = 1; i <= m; i++) {
c = c * n;
}
if (c / 1000000001 >= 1 || c == 0) {
cout << -1;
return 0;
}
cout << c;
return 0;
}