#include using namespace std; int main() { int w, d; cin >> w >> d; while (d > 1) { w = w - (w / (d*d)); d--; } cout << w << endl; }