#include int main() { long long int w, d; scanf("%lld%lld", &w, &d); for (; d > 1; d--) w -= w / (d * d); printf("%lld\n", w); return 0; }