#include "bits/stdc++.h" using namespace std; int main(){ int W, D; cin >> W >> D; while (D > 1){ W -= W / D / D; D--; } cout << W << endl; }