N,M=map(int,input().split()) ans = 0 M2 = M while M>1: ans += M M = (M+1)>>1 N-=1 ans += N if M!=1: ans = (1<