#include using namespace std; signed main(){ int w , d; cin >> w >> d; int rest = w; for( int i = d ; i >= 2 ; --i){ rest = rest - static_cast(rest / ( i * i )); } cout << rest << endl; }