H, A = map(int, input().split()) cnt = 1 ans = 0 while H > 1: H /= 2 ans += cnt cnt *= 2 print(ans)