#t464. 小球

小球

Background

Special for beginners, ^_^

Description

Many balls fall one by one down a full binary tree (FBTFBT, Full Binary TreeFull\ Binary\ Tree). At each moment, a falling ball first visits a non-leaf node. As it continues to fall, it goes either into the right subtree or the left subtree, until it reaches a leaf node. The direction a ball takes is determined by the boolean value stored at each node. Initially all nodes are falsefalse. When a ball visits a node: if the node is falsefalse, the ball sets it to truetrue and then continues its journey down the left subtree; if the node is truetrue, the ball sets it to falsefalse and then continues down the right subtree. The labeling of the full binary tree is shown in the figure below.

Because all nodes are initially falsefalse, the first ball visits node 11, node 22 and node 44, toggles their boolean values, and finally stops at node 88. The second ball visits node 11, node 33 and node 66, and stops at node 1212. Clearly, before it stops, the third ball visits node 11, node 22 and node 55, and stops at node 1010.

Your task: given the depth D D\ of the FBTFBT and II (meaning the II-th ball is dropped; you may assume II does not exceed the number of leaves of the given FBTFBT), write a program that finds the leaf number at which the ball stops.

Format

Input

The input consists of a single line containing two integers DD and II separated by a space, where 2≤D≤20,1≤I≤5242882\le D \le 20,1\le I\le 524288.

Output

Output the leaf number at which the II-th ball stops.

Samples

4 2
12

Limitation

1s, 1024KiB for each test case.