#include using namespace std; typedef long long ll; int main() { ll W, D; cin >> W >> D; for (int i = 0; i < D-1; ++i) { ll d = D-i; W -= W/(d * d); } cout << W << endl; }