#include int main() { int w, d; std::cin >> w >> d; for (; d > 1; --d) { w -= (w / d / d); } std::cout << w << std::endl; return 0; }