H,A = map(int,input().split()) now = 1 ans = 0 while H >0: H //= A ans += now now *= 2 print(ans)