#include int yaruki(int W,int D){ int y,t; if(D==1)return W; y=W/(D*D); t=W-y; return yaruki(t,D-1); } int main(void){ int W,D; scanf("%d",&W); scanf("%d",&D); printf("%d\n",yaruki(W,D)); return 0; }