n people numbered 1 to n around a circle, we eliminate every second remaining person until only one survives. Define a function J(n), represents the survivor's original number in the circle. For example, J(2)=1, J(10)=5. Now, please calculate this nested function: J(J(J(..J(n)..)))
There are multiple test cases, each with two positive numbers in one line.
The first number represents the number of the people in original cirlcle, the second one represents the times of the function nested.
All the numbers in input file will be less than 2^63-1.
output the result in one line per test case.
2 1 10 1 10 2
1 5 3