#include using namespace std; signed main(){ int W, D; cin >> W >> D; for( int i = D - 1; i >= 2; --i ){ W -= W / ( D * D ); } cout << W << endl; return 0; }