N, M = map(int, input().split()) sum_total = 0 current = 1 for step in range(1, N + 1): remaining = N - step if remaining >= 30: max_x = 1 else: power = 1 << remaining # 2^remaining max_x = (M + power - 1) // power next_val = min(2 * current, max_x) sum_total += next_val current = next_val print(sum_total)