#include using namespace std; typedef long long ll; ll N, K; bool check(ll x) { if(N - x <= 0) return true; ll rem = N - x; return rem < (long double)x * K; } int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> N >> K; ll ng = 0, ok = N; while(abs(ng - ok) > 1) { ll mid = (ng + ok) / 2; if(check(mid)) ok = mid; else ng = mid; } cout << ok << endl; }