#include<iostream> #include<cmath> using namespace std; int main(){ int b,n,result,i,minj,minx,tmp; while(scanf("%d%d",&b,&n)==2&&b){ minx = 1000005; for(i=1;;i++){ tmp = pow((double)i,n); if(tmp<b){ if(b-tmp<minx){ minx = b-tmp; minj = i; } } else if(tmp==b){ minx = 0; minj = i; break; } else if(tmp>b){ if(tmp-b<minx){ minx = tmp-b; minj = i; } break; } } printf("%d\n",minj); } return 0; }