Bit sorting#1649

Bit sorting

1 second
128 megabytes
Hard

We define the following order on the set of non-negative integers: For two numbers and , we say that is less than if one of the following holds:

  1. The number of ones in the binary representation of is less than that of .

  2. The number of ones in the binary representation of equals that of , and A < B (in the usual sense).

Now, sort all integers from to inclusive in ascending order according to this new relation. Your task is to determine which number will be at position . Positions are numbered starting from one.

Input

The first line contains two integers and (0 \leq n \leq 10^{16}, 1 \leq k \leq n + 1).

Output

Print the -th number in the sorted sequence.

Examples

Example 1

Loading
Loading

Note

The numbers from to will be sorted as follows: , , , , , , , , , , .