H, A = map(int, input().split()) arr = {H} ans = 0 while arr: t = arr.pop()//A if t > 0: arr.add(t) ans += 2 print(ans-1)