#include using namespace std; int main(void){ int n; cin >> n; long long m; cin >> m; for (int i = m; i >= 1; --i){ long long now = n / (i * i); // cout << now << endl; if(i != 1) n -= now; } cout << n << endl; return 0; }