#include<bits/stdc++.h>
using namespace std;
long long a,b;
int main(){
cin>>a>>b;
if(pow(a,b)>pow(10,9)){
cout<<-1<<endl;
}
else{
cout<<int (pow(a,b));
}
return 0;
}
10-30
555

02-05
1992

04-27
701
