#include<bits/stdc++.h> using namespace std; int main(){ int a,b; cin>>a>>b; if (a==1) cout<<1<<endl; else{ long long ret=1; for(int i=1;i<=b;i++){ ret=ret*a; if(ret>1e9){ cout<<-1<<endl; return 0; } } cout<<ret<<endl; } }