N,M = map(int,input().split()) Min = 0 ans = 0 while M > 1 and N>0: N -= 1 ans += M M = (M+1)//2 Min = Min * 2 + 1 print(min(Min,ans))