Problem: You are given a sequence consisting of integers , and an integer . Your task is to make the sequence sorted (it is considered sorted if the condition holds).
To make the sequence sorted, you may perform the following operation any number of times you want (possibly zero): choose an integer such that and , and swap the values of and .
For example, if , , the following sequence of operations is possible:
- choose (it is possible since ), then , ;
- choose (it is possible since ), then , ;
- choose (it is possible since ), then , .
Calculate the minimum number of operations you have to perform so that becomes sorted, or report that it is impossible.
Input Format: The first line contains one integer () — the number of test cases.
Each test case consists of two lines. The first line contains two integers and (, ) — the number of elements in the sequence and the initial value of .
The second line contains integers , , ..., ().
The sum of values of over all test cases in the input does not exceed .
Output Format: For each test case, print one integer — the minimum number of operations you have to perform to make sorted, or , if it is impossible.