#include"bits/stdc++.h" using namespace std; int main() { long int d, w; cin >> w >> d; while (true) { if (w - w / (d*d) <= 0) { cout << w / (d*d) << endl; return 0; } w -= w / (d*d); d--; } }