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
import java.io.*;
import java.util.*;

public class Equal {

	static ArrayList<Integer>[] adj;

	static boolean check(int[] arr) {
		boolean f = true;
		for (int i = 1; i < arr.length; i++) {
			f &= arr[i] >= arr[i - 1];
		}
		return f;
	}

	public static void main(String[] args) throws IOException {
		// BufferedReader br = new BufferedReader(new FileReader("name.in"));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		PrintWriter pw = new PrintWriter(System.out);

		int t = Integer.parseInt(br.readLine());
		while (t-- > 0) {
			st = new StringTokenizer(br.readLine());
			int n = (int) Long.parseLong(st.nextToken());
			int k = (int) Long.parseLong(st.nextToken());
			int[] a = new int[n];
			st = new StringTokenizer(br.readLine());
			PriorityQueue<pair> q = new PriorityQueue<>();
			for (int i = 0; i < a.length; i++) {
				a[i] = Integer.parseInt(st.nextToken());
				q.add(new pair(i, a[i]));
			}
			int last =k;
			int id =0;
			int c=0;
			for (int i = 0; i < a.length && !check(a); i++) {
				
//				System.out.println(q+" "+last);
				
				while(id<a.length &&  a[id]<=last) {
					id++;
				}
				if(id<a.length) {
					int temp=a[id];
					a[id] =last;
					last=temp;
					id++;
					c++;
				}
//				System.out.println(Arrays.toString(a));
//				pair[] p = new pair[n];
//				for (int i = 0; i < p.length; i++) {
//					p[i] = new pair(i, a[i]);
//				}
//				Arrays.sort(p);
				
			}
			pw.println(check(a)?c:-1);
			

		}

		pw.flush();

	}

	static int m;

	static int[][] matMul(int[][] A, int[][] B, int p, int q, int r) // C(p x r) = A(p x q) x (q x r) -- O(p x q x r)
	{
		int[][] C = new int[p][r];
		for (int i = 0; i < p; ++i)
			for (int j = 0; j < r; ++j)
				for (int k = 0; k < q; ++k) {
					C[i][j] += (A[i][k] * 1l * B[k][j]) % m;
					C[i][j] %= m;
				}
		return C;
	}

	/*
	 * 4. Square Matrix Exponentiation
	 */
	static int[][] matPow(int[][] base, long p) {
		int n = base.length;
		int[][] ans = new int[n][n];
		for (int i = 0; i < n; i++)
			ans[i][i] = 1;
		while (p != 0) {
			if ((p & 1) == 1)
				ans = matMul(ans, base, n, n, n);
			base = matMul(base, base, n, n, n);
			p >>= 1;
		}

		return ans;
	}

	static long powmod(long r, long e, long mod) {
		long ans = 1;
		r %= mod;
		while (e > 0) {
			if ((e & 1) == 1)
				ans = (int) ((ans * 1l * r) % mod);
			e >>= 1;
			r = (int) ((r * 1l * r) % mod);
		}
		return ans;
	}

	static class SegmentTree { // 1-based DS, OOP

		int N; // the number of elements in the array as a power of 2 (i.e. after padding)
		int[] array, sTree, lazy;

		SegmentTree(int[] in, int s) {
			array = in;
			N = in.length - 1;
			sTree = new int[N << 1]; // no. of nodes = 2*N - 1, we add one to cross out index zero
			lazy = new int[N << 1];
			build(1, 1, N, s);
		}

		void build(int node, int b, int e, int s) // O(n)
		{
			if (b == e)
				sTree[node] = array[b];
			else {
				int mid = b + e >> 1;
				build(node << 1, b, mid, s);
				build(node << 1 | 1, mid + 1, e, s);
				if (s == 0) {
					sTree[node] = Math.max(sTree[node << 1], sTree[node << 1 | 1]);
				} else {
					sTree[node] = Math.min(sTree[node << 1], sTree[node << 1 | 1]);

				}
			}
		}

		void update_point(int node, int val, int s) // O(log n)
		{
			node += N - 1;
			sTree[node] += val;
			while (node > 1) {
				node >>= 1;
				if (s == 0) {
					sTree[node] = Math.max(sTree[node << 1], sTree[node << 1 | 1]);
				} else {
					sTree[node] = Math.min(sTree[node << 1], sTree[node << 1 | 1]);

				}
			}
		}

		void update_range(int i, int j, int val) // O(log n)
		{
			update_range(1, 1, N, i, j, val);
		}

		void update_range(int node, int b, int e, int i, int j, int val) {
			if (i > e || j < b)
				return;
			if (b >= i && e <= j) {
				sTree[node] += (e - b + 1) * val;
				lazy[node] += val;
			} else {
				int mid = b + e >> 1;
				propagate(node, b, mid, e);
				update_range(node << 1, b, mid, i, j, val);
				update_range(node << 1 | 1, mid + 1, e, i, j, val);
				sTree[node] = sTree[node << 1] + sTree[node << 1 | 1];
			}

		}

		void propagate(int node, int b, int mid, int e) {
			lazy[node << 1] += lazy[node];
			lazy[node << 1 | 1] += lazy[node];
			sTree[node << 1] += (mid - b + 1) * lazy[node];
			sTree[node << 1 | 1] += (e - mid) * lazy[node];
			lazy[node] = 0;
		}

		int query(int i, int j, int s) {
			return query(1, 1, N, i, j, s);
		}

		int query(int node, int b, int e, int i, int j, int s) // O(log n)
		{
			if (i > e || j < b) {
				if (s == 0)
					return 0;
				return Integer.MAX_VALUE / 2;
			}
			if (b >= i && e <= j)
				return sTree[node];
			int mid = b + e >> 1;
			propagate(node, b, mid, e);
			int q1 = query(node << 1, b, mid, i, j, s);
			int q2 = query(node << 1 | 1, mid + 1, e, i, j, s);
			if (s == 0)
				return Math.max(q1, q2);
			else
				return Math.min(q1, q2);

		}

	}

	static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int d, int u) {
			x = d;
			y = u;
		}

		@Override
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
			return y - o.y;
		}

		@Override
		public String toString() {
			// TODO Auto-generated method stub
			return x + " " + y;
		}

	}

}