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