#include int main(){ long long int a,b,c; scanf("%lld%lld",&a,&b); for(;b>0;b--)a-=c=a/b/b; printf("%lld",c); return 0; }