You are given a sequence a consisting of n integers a_1, a_2, ..., a_n, and an integer x. Your task is to make the sequence a sorted (it is considered sorted if the condition a_1 ≤ a_2 ≤ a_3 ≤ ... ≤ a_n holds).

To make the sequence sorted, you may perform the following operation any number of times you want (possibly zero): choose an integer i such that 1 ≤ i ≤ n and a_i > x, and swap the values of a_i and x.

For example, if a = [0, 2, 3, 5, 4], x = 1, the following sequence of operations is possible:

  1. choose i = 2 (it is possible since a_2 > x), then a = [0, 1, 3, 5, 4], x = 2; 
  2. choose i = 3 (it is possible since a_3 > x), then a = [0, 1, 2, 5, 4], x = 3; 
  3. choose i = 4 (it is possible since a_4 > x), then a = [0, 1, 2, 3, 4], x = 5. 



Calculate the minimum number of operations you have to perform so that a becomes sorted, or report that it is impossible.

Input

The first line contains one integer t (1 ≤ t ≤ 500) — the number of test cases.

Each test case consists of two lines. The first line contains two integers n and x (1 ≤ n ≤ 500, 0 ≤ x ≤ 500) — the number of elements in the sequence and the initial value of x.

The second line contains n integers a_1, a_2, ..., a_n (0 ≤ a_i ≤ 500).

The sum of values of n over all test cases in the input does not exceed 500.

Output

For each test case, print one integer — the minimum number of operations you have to perform to make a sorted, or -1, if it is impossible.

Example

Input


6
4 1
2 3 5 4
5 6
1 1 3 4 4
1 10
2
2 10
11 9
2 10
12 11
5 18
81 324 218 413 324


Output


3
0
0
-1
1
3
# SHRi GANESHA    author: Kunal Verma #
import operator
import os,sys
from collections import defaultdict, Counter, deque
from io import BytesIO, IOBase
from itertools import accumulate
from math import gcd, ceil, inf, sqrt, floor



def lcm(a,b):
    return (a*b)//gcd(a,b)
'''
    mod = 10 ** 9 + 7
    fac = [1]
    for i in range(1, 2 * 10 ** 5 + 1):
        fac.append((fac[-1] * i) % mod)
    fac_in = [pow(fac[-1], mod - 2, mod)]
    for i in range(2 * 10 ** 5, 0, -1):
        fac_in.append((fac_in[-1] * i) % mod)
    fac_in.reverse()

    def comb(a, b):
        if a < b:
            return 0
        return (fac[a] * fac_in[b] * fac_in[a - b]) % mod
'''
MAXN = 100001
spf = [0 for i in range(MAXN)]
def getFactorization(x):
    ret = list()
    while (x != 1):
        ret.append(spf[x])
        x = x // spf[x]
    return ret
def printDivisors(n):
    i = 2
    z=[]
    while i <= sqrt(n):
        if (n % i == 0):
            if (n / i == i):
                z.append(i)
            else:
                z.append(i)
                z.append(n//i)
        i = i + 1
    return z

def cheaker(a):
    j=1
    p=False
    for i in a:
        if i!=(j):
            break


        j+=1
    q=len(a)
    for i in a[::-1]:
        if i!=q:
            break
        q-=1
    for i in range(j-1,q):
        if a[i]==i+1:
            return False


    return True


def create(n, x,f):
    pq = len(bin(n)[2:])
    if f==0:
        tt=min
    else:
        tt=max
    dp = [[inf] * n for _ in range(pq)]
    dp[0] = x
    for i in range(1, pq):
        for j in range(n - (1 << i) + 1):
            dp[i][j] = tt(dp[i - 1][j], dp[i - 1][j + (1 << (i - 1))])
    return dp


def enquiry(l, r, dp,f):
    if l > r:
        return inf if not f else -inf
    if f==1:
        tt=max
    else:
        tt=min
    pq1 = len(bin(r - l + 1)[2:])- 1
    return tt(dp[pq1][l], dp[pq1][r - (1 << pq1) + 1])



def main():
    for _ in range(int(input())):
        n, x = map(int, input().split())
        a=[int(x) for x in input().split() ]
        an=1
        p=n
        if a==sorted(a):
            print(0)
        else:
            for i in range(n):
                if a[i]>x:
                    p=i
                    break
                else:
                    if i>0:

                        if a[i-1]>a[i]:
                            an=-1
                            break
            q=[False]*n
            q[-1]=True
            for i in range(n-2,-1,-1):
                 if a[i]<=a[i+1]:
                     q[i]=True
                 else:
                     break

            if an==1:
                c = 0
                for i in range(p,n):

                    if x<a[i]:
                        x,a[i]=a[i],x

                        c+=1
                        if i!=n-1:
                            if a[i+1]>=a[i] and q[i+1]:
                                break
                #print(c,a)
                if a==sorted(a):
                    an=1
                else:
                    an=-1
            if an==1:
                print(c)
            else:
                print(-1)

#Fast IO Region
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
if __name__ == '__main__':
    main()
