A horrifying new species of slime was just discovered, the "tree slime". A normal slime splits into smaller slimes when it is killed. Tree slimes work differently.
On command, a tree slime of size $$$k \gt 1$$$ will spawn 2 smaller tree slimes of size $$$k-1$$$; the larger tree slime remains unharmed in the process, though it can only do this once in its life. Those smaller tree slimes can also spawn 2 tree slimes of size $$$k-2$$$, until tree slimes of size 1 are spawned, which are the smallest possible tree slime and cannot spawn any smaller tree slimes.
Luckily, the scientists in the village have made a breakthrough. They've found that, if any of the tree slimes die, the tree slime they spawned from – the "parent" – also dies. So, if you hit a tree slime to kill it, then its parent will also die if it's still alive, and the parent's parent as well, and so on.
Suddenly, you hear a terrifying rumble. The village lookout spots a massive tree slime approaching the village. Right before your eyes, this tree slime and all of its descendants spawn all the tree slimes they possibly can. The lookout counts and says there is a line of $$$2^n$$$ size 1 tree slimes leading the charge, with all of the parent tree slimes following behind. The blacksmith has forged you a sword in a hurry, but it only has $$$h$$$ hits before it breaks. What's the maximum number of tree slimes you can kill?
NOTE: Both the input and output may be large, make sure to use 64-bit integers (C/C++: long long, C#/Java: long, Python: doesn't matter)
The first and only line contains two space-separated integers, $$$n$$$ $$$(1 \le n \le 62)$$$ and $$$h$$$ $$$(1 \le h \le 2^n)$$$. This means there are $$$2^n$$$ size 1 tree slimes with all of their parents and parents' parents, etc, and you have $$$h$$$ hits before your sword breaks.
Print a single integer: the maximum number of tree slimes you can kill with $$$h$$$ hits of your sword.
2 3
6
2 4
7