N, M = map(int, input().split()) s, c = 0, 0 while M!=1: s += M c += 1 M = (M+1)//2 if c