import queue h,a = map(int,input().split()) sr = queue.LifoQueue() sr.put(h) ans = 0 while True: if sr.empty(): print(ans-1) exit() else: h_now = sr.get() if h_now//a!=0: sr.put(h_now//a) ans += 2