def main(): N, M = map(int, input().split()) ans = 0 m = M for i in range(N): if m == 1: ans += N - i break ans += m m = (m + 1) // 2 if m != 1: ans = 0 m = 1 for _ in range(N): ans += m m *= 2 return ans print(main())