On the set of nonnegative integers, we introduce the following order relation: we assume that the number of A is less than the number of B in two cases:
When a binary number in units of A is less than B.
When a binary number with A as many units as in B, and A less than B in the usual sense.
Now sort ascending set of all integers from 0 to n inclusive, using this new order relation. Your task is to find how many will be in position k. Numbering of positions is carried out with the unit.
The first line contains the integers n and k (0 ≤ n ≤ 10^16
, 1 ≤ k ≤ n + 1).
Print the k-th number in the sorted sequence.
Numbers from 0 to 10 will be sorted in the next way: 0, 1, 2, 4, 8, 3, 5, 6, 9, 10, 7.