Voldemort's Army

Voldemort is training his army of death eaters to finish Harry. To keep the training process easy for himself too, he wants to arrange the death eaters in the increasing order of their strength. Each death eater has some unique positive value of strength. Task is simple, he just need to sort the death eaters in the increasing order of strength. But Voldemort is not aware of any efficient sorting technique. He’s using following algorithm in order to complete the task-

  1. He will choose any K consecutive death eaters where K is less than or equal to total number of death eaters.
  2. He will then reverse the order of those K death eaters.
  3. He will perform above 2 operations until he found all the death eaters arranged in increasing order of their strength.

Now this is a time consuming process, so Voldemort is interested in knowing the minimum number of times he has to apply above steps so as to complete the task and if it is impossible to obtain a sorted sequence of death eaters using this technique then simply print -1 .

Input

First line of input contains an integer T denoting number of test cases. First line of each test case contains two numbers N and K. Next line contains N space separated unique integers representing the strength of N death eaters.

Output

Print the minimum number of times he must use his algorithm to arrange death eaters in desired order or -1 if it is impossible to obtain required sequence using given algorithm. Answer each test case in a new line.

Constraints

1<=T<=101
2<=N<=8
2<=K<=N
1<=strength<=100

Time limit

8 second

Sample Input

 2  
5 3  
5 4 1 2 3  
5 4  
3 2 4 1 5  

Sample Output

 3  
-1
//