n, k = map(int, input().split()) ans = n // (k + 1) + (n % (k + 1)) // 2 + (n % (k + 1)) % 2 print(ans)