import sys input = sys.stdin.readline N,M=map(int,input().split()) if N<=100 and M>=2**(N-1): print(2**N-1) exit() ANS=[M] while len(ANS)