#include //cin, cout #include //vector #include //sort,min,max,count #include //string,getline, to_string #include //abs(int) #include //swap, pair #include //deque #include //INT_MAX #include //bitset #include //sqrt, ceil. M_PI, pow, sin using namespace std; int main() { long long int W, D; cin >> W >> D; if (W < D* D) { D = static_cast(sqrt(W)); } for (long long int i = D; i > 1; i--) { long long int a = W / (i * i); W = W - a; } cout << W << endl; return 0; }