#include int main(void){ long long W, D; scanf("%lld %lld", &W, &D); while(D>1){ W -= W / (D*D); D--; } printf("%lld\n", W); return 0; }