#include <bits/stdc++.h>
using namespace std;
long long a, b;
long long x = 1;
void input()
{
cin >> a >> b;
}
void work()
{
while (b--)
{
if (x > 1000000000)
{
cout << -1;
return;
}
else
x = x * a;
}
cout << x;
}
int main()
{
input();
work();
return 0;
}