H,A = map(int,input().split()) ans = 0 for i in range(1000): if H >= 1: H //= 2 ans += 2**i print(ans)