Counting Game

Problem Description
Let's define the number of '1' of X in base 2 is V(X).Now give you an X and a k, please give me the kth number Y strictly greater than X and V(X) = V(Y).

Input
Input includes several cases. Each case contains one line with two integers X, k. Input ends with a case X = 0 and k = 0. X is a 32-bit integer, 0 < K <= 50000.

Output
Every case print a integer Y in a line. Y is guaranteed to be a 32-bit integer.

Sample Input
5 1
481 2
0 0

Sample Output
6
484