#include using namespace std; typedef unsigned long long ul; typedef signed long long ll; ul over = 1000000007; int main(void) { cin.tie(0); ios::sync_with_stdio(false); cout << fixed; ll w, d; cin >> w >> d; for (ll i = d; i > 1; --i) { w -= w/(i*i); } cout << w << endl; return 0; }