Roy is going to organize Finals of Coding Contest in his college's computer labs. According to the rules of contest, problem statements will be available on each computer as pdf file.
Now there are N number of computers and only one of them has the pdf file. Roy has collected M number of pendrives from his friends. Copying pdf from computer to pendrive or from pendrive to computer takes exactly 1 minute. Roy has to copy pdf to all N computers in minimum (optimal) time possible. You are to find this minimum time. Please see Sample Test Explanation for clarity.
Input:
First line will contain integer T - number of test cases.
Next T lines each will contain two space separated integers, N - number of computers, M - number of pendrives.
Output:
Print the minimum time (in minutes) for each test case in a new line.
Constraints:
\(1 \le T \le 10000\)
\( 1 \le N,M \le 1000000000 (10^9)\)