#include<iostream>//str(函数).size() getline(cin,a) 函数.append(添加字符串,下标,个数) or (个数,'字符串') 函数.find查找 of rfind倒查找 替换 函数.replace(下标,个数,函数,下标,个数)
#include<string>// erase(下标,个数)or()全删删除 插入 函数.insert(下标,到指定的前面,函数, 下标,个数 or 直接添加)
#include<cmath>
#include<iomanip>
#include<algorithm>
using namespace std;
int main()
{
long long n,s,t;
cin>>n>>s;
if(n == 1)
{
cout << 1 << endl;
return 0;
}
if(s == 1)
{
cout << n << endl;
return 0;
}
if(n > 31622)
{
cout << -1 << endl;
return 0;
}
if(s > 29)
{
cout << -1 << endl;
return 0;
}
t=n;
if (n>100000||s>100000)
{
cout<<"-1"<<endl;
return 0;
}
for (long long i=0;i<s;i++)
{
t*=t;
if (t*t>1000000000||n>1000000000||s>1000000000)
{
cout<<"-1"<<endl;
return 0;
}
}
cout<<t<<endl;
return 0;
}