H, A = map(int, input().split()) ans = 1 temp = 1 while True: if H // A > 0: temp *= 2 ans += temp H //= A else: break print(ans)