#JSUTFPC2025I. Bitwise Operation——位运算

Bitwise Operation——位运算

Statement

Timothy is a young computer scientist who has recently been exploring the fascinating properties of binary arithmetic. While organizing some old manuscripts left by his grandfather, he stumbled upon a mysterious mathematical formula:

(x & y)+(x  y)=T(x \ \&\ y) + (x \ |\ y) = T

Here, TT represents the "balanced number", and the bitwise operators &\& and | represent bitwise AND and bitwise OR operations, respectively. In mainstream programming languages, & is used to represent bitwise AND, for example, int c = a \& b is represented as ca & bc\leftarrow a\ \&\ b, and bitwise OR is similarly represented.

To be precise, the bitwise AND operator follows this rule: the result bit is 1 only when both corresponding binary bits are 1; otherwise, it is 0. For example, consider calculating 5 & 95\ \&\ 9 (the lower right corner indicates the base 10 or base 2)

$$5_{(10)}\ \&\ 9_{(10)} = 0101_{(2)}\ \&\ 1001_{(2)}=0001_{(2)}=1_{(10)} $$

Similarly, bitwise OR means that when at least one of the two corresponding bits is 1, the result bit is 1; otherwise, it is 0.

Timothy speculated that this formula might hide some kind of symmetry in binary bit operations. If he could find the smallest positive integer yy that satisfies the condition, he would be able to unlock the next password in the notebook.

However, not all pairs of xx and TT can find a corresponding yy. If no such yy exists, it indicates that this xx has no affinity with the "balanced number", and a return value of 1-1 is required.

Please help Timothy write a program to find the smallest positive integer yy for a given xx and TT, or determine if it does not exist.

Input

The input contains a line with two integer numbers representing xx and TT respectively, where (0x,T1×1018)(0 \leqslant x,T \leqslant 1 \times 10^{18}) and they are separated by a space.

Output

It contains an integer representing yy.

Samples

114514 1919810
1805296
1919810 114514
-1