from collections import deque H,A = map(int,input().split()) ans = 0 Deq = deque() Deq.append(H) while Deq: h = Deq.popleft() h2 = h//2 ans += 1 if h2 >= 1: Deq.append(h2) Deq.append(h2) print(ans)