C. Huge Pile
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Andrei has a huge pile of $$$n$$$ apples. He can divide the pile into two smaller piles: if there are $$$x$$$ apples in the pile, he will get piles with $$$\lfloor \frac{x}{2} \rfloor$$$$$$^{\text{∗}}$$$ and $$$\lceil \frac{x}{2} \rceil$$$$$$^{\text{†}}$$$ apples. This division takes Andrei $$$1$$$ minute.

Andrei wants to eat $$$k$$$ apples, but he doesn't want to count them at all. That is why he wants to obtain a pile that contains exactly $$$k$$$ apples. Determine whether it is possible to achieve this by performing pile divisions. If it is possible, find the minimum possible time for Andrei to obtain a pile with exactly $$$k$$$ apples.

$$$^{\text{∗}}$$$$$$\lfloor \frac{x}{2} \rfloor$$$ — the largest integer $$$\le \frac{x}{2}$$$.

$$$^{\text{†}}$$$$$$\lceil \frac{x}{2} \rceil$$$ — the smallest integer $$$\ge \frac{x}{2}$$$.

Input

Each test consists of several test cases. The first line contains a single integer $$$t$$$ $$$(1 \le t \le 10^4)$$$ — the number of test cases. The following lines describe the test cases.

In the only line of each test case, two integers $$$n$$$ and $$$k$$$ are given — the number of apples in the huge pile and the number of apples that Andrei wants to obtain in one pile $$$(1 \le n, k \le 10^9)$$$.

Output

For each test case, output $$$-1$$$ if it is impossible to obtain a pile with exactly $$$k$$$ apples. Otherwise, output the minimum possible time required to obtain such a pile.

Example
Input
4
10 3
11 5
21 4
1000000000 1
Output
2
1
-1
29
Note

In the first test case, after the first division, two piles of $$$5$$$ apples will be created. If one of them is divided, it will result in piles with $$$2$$$ and $$$3$$$ apples, so the answer is $$$2$$$.

In the second test case, if the pile is divided into two, it will result in piles with $$$5$$$ and $$$6$$$ apples, so the answer is $$$1$$$.

In the third test case, it is only possible to obtain piles with $$$1$$$, $$$2$$$, $$$3$$$, $$$5$$$, $$$6$$$, $$$10$$$, $$$11$$$, or $$$21$$$ apples, so the answer is $$$-1$$$.