#include using namespace std; int main(){ long long N,K,ans; cin >> N >> K; ans=N/(K+1); if(K==1) ans++; else if(N%(K+1)==0) ans++; else ans+=N%(K+1)%K; cout << ans << endl; return 0; }