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.*;

import static java.lang.Math.*;

public class Contest {
    public static class pair implements Comparable<pair> {
        long l;
        long r;


        public pair(long lef, long ri) {
            l = lef;
            r = ri;
        }

        @Override
        public int compareTo(pair p) {
            if (l == p.l)
                return Long.compare(r, p.r);
            return Long.compare(l, p.l);
        }
    }

    static int n, m;
    static ArrayList<Integer>[] adj;
    static int dist[];
    static int[] h;
    static int[] p;
    static int parent[];
    static long inf = (long) 1e18;
    static int INF = (int) 1e9;


    public static int ciel(int d, int mod) {
        if (d % mod == 0)
            return d / mod;
        return (d / mod) + 1;
    }


    public static long gcd(long u, long v) {
        if (v == 0)
            return u;
        return gcd(v, u % v);
    }

    static int k, Arr[], lefAcc[], riAcc[];
    static PrintWriter pw;

    static int memo[][][];
    static char[][] Matrix;
    static int[][] dp;
//    static int[] dx = new int[]{-1, 1, 0, 0};
//
//    static int[] dy = new int[]{0, 0, -1, 1};


    static boolean valid(int i, int j) {

        return i != -1 && j != -1 && i != n && j != m;

    }


    static boolean[][] vis, vis1, explored;
    static int x, y;


    static long[] fac;

    public static void div(long n) {
        for (long i = 1; i * i <= n; i++) {
            long mod = n % i;
            if (mod == 0) {
                divisors.add(i);
                divisors.add(n / i);
            }
        }
        divisors.add(n);
    }

    public static void div2(long n) {
        for (long i = 1; i * i <= n; i++) {
            long mod = n % i;
            if (mod == 0) {
                divisors2.add(i);
                divisors2.add(n / i);
            }
        }
        divisors2.add(n);
    }

    static TreeSet<Long> divisors, divisors2;

    public static void rearrange(int[] Arr, int lo, int hi) {
        if (lo >= hi - 1)
            return;
        int n = hi - lo + 1;
        for (int i = 0; i < n / 4; i++) {
            int loIdx = i + lo + n / 4;
            int hiIdx = i + lo + n / 2;
            int temp = Arr[loIdx];
            Arr[loIdx] = Arr[hiIdx];
            Arr[hiIdx] = temp;
        }
        rearrange(Arr, lo, lo + n / 2 - 1);
        rearrange(Arr, lo + n / 2, hi);

    }

    public static int[] minMax(int l, int r, int[] Arr) {
        if (l == r)
            return new int[]{Arr[l], Arr[l], 0};
        int mid = (l + r) / 2;
        int[] ansLeft = minMax(l, mid, Arr);
        int[] ansRight = minMax(mid + 1, r, Arr);
        return new int[]{min(ansLeft[0], ansRight[0]), max(ansLeft[1], ansRight[1]), max(max(ansLeft[2], ansRight[2]), ansRight[1] - ansLeft[0])};

    }

    double sum = 0;
    static double dem;
    static Stack<Integer> st = new Stack<>();

    public static int maxHieght(int[] Arr) {
        int[] left = new int[n];
        int[] right = new int[n];
        int[] lev = new int[n];
        int max = 1;
        lev[0] = 1;
        for (int i = 0; i < n; i++) {

            for (int j = 0; j < i; j++) {
                if (Arr[i] > Arr[j]) {
                    if (right[j] == 0) {
                        right[j] = i;
                        max = max(max, lev[i] = lev[j] + 1);
                        break;
                    } else j = right[j] - 1;
                } else {
                    if (left[j] == 0) {
                        left[j] = i;
                        max = max(max, lev[i] = lev[j] + 1);
                        break;
                    } else j = right[j] - 1;
                }
            }
        }
        return max;
    }

    public static long gen(int idx, int[] Arr, int bitmask) {
        if (idx == n) {
            return maxHieght(Arr);
        }
        long ans = 0;
        for (int i = 1; i <= n; i++) {
            if ((bitmask & (1 << i)) == 0) {
                Arr[idx] = i;
                ans += gen(idx + 1, Arr, bitmask | (1 << i));
            }
        }
        return ans;

    }

    static int[] S;
    static int N;
    static String str;

    public static char whoWin(char aa, char bb) {
        char a = (char) min(aa, bb);
        char b = (char) max(aa, bb);
        if (a == 'P' && b == 'R')
            return 'P';
        if (a == 'P' && b == 'S')
            return 'S';
        if (a == 'R' && b == 'S')
            return 'R';

        return a;
    }

    public static int takeMod(long x) {
        return (int) (x % n);
    }

    static long pow(long a, int n, long mod) {
        long res = 1;
        while (n != 0) {
            if ((n & 1) == 1)
                res *= a;
            a *= a;
            res %= mod;
            a %= mod;
            n >>= 1;
        }
        return res % mod;
    }

    public static long powMod(long base, long pow, long mod) {
        if (pow == 0) return 1;
        long x = (powMod(base, pow / 2, mod));
        return (((x * x) % mod) * (pow % 2 == 1 ? base : 1)) % mod;
    }

    public static boolean check(int x, int y, int idx) {
        int length = str.length();
        if (x < 0 || x > length - 1 || y < 0 || y > length - 1)
            return true;
        if (Grid[x][y] != str.charAt(idx))
            return true;
        return false;
    }

    public static int dp(int idx, int x, int lastValue) {
        if (idx == n) return 0;
        if(memo[idx][x][lastValue]!=-1)
            return memo[idx][x][lastValue];
        if (Arr[idx] < lastValue)
            return (int) 1e9;
        int ans = (int) 1e9;
//      System.err.println(idx+" "+x+" "+Arr[idx]+" "+lastValue);
        if (Arr[idx] > x && x >= lastValue)
            ans = min(ans, 1 + dp(idx + 1, Arr[idx], x));
        ans = min(ans, dp(idx + 1, x, Arr[idx]));

        return memo[idx][x][lastValue]=ans;
    }

    static char[][] Grid;

    public static void fill(int length) {
        Grid = new char[length][length];
        for (int i = 0; i < length; i++) {
            int idx = Math.min(i, length - i - 1);
            int mid = (length - 1) / 2;
            for (int k = 0, j = mid - idx; j < mid + 1; k++, j++) {
                Grid[i][j] = str.charAt(k);
                Grid[i][length - j - 1] = str.charAt(k);
            }
        }
    }


    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        pw = new PrintWriter(System.out);
        int t = sc.nextInt();
        while (t-- > 0) {
            n = sc.nextInt();
            int x = sc.nextInt();
            Arr = new int[n];
            for (int i = 0; i < n; i++) {
                Arr[i] = sc.nextInt();
            }
            memo = new int[n][502][502];
            for (int[][] y : memo)for (int[] z : y) Arrays.fill(z, -1);
            long dpAns = dp(0, x, 0);
            pw.println(dpAns >= 1e9 ? -1 : dpAns);
//        long [][]dp=new long[n][510];
//        for(long[]y:dp)Arrays.fill(y,-1);
//        for (int i = 0; i < n; i++) {
//            for (int j = 0; j < 510; j++) {
//                long ans=1e15
//                if(Arr[i]<j){
//                   ans=min(ans,dp[i-1][j])
//                }
//                if(Arr[i]>=Arr[i-1]){
//
//                }
//            }
//        }
        }
        pw.close();

    }

    static long mod = (long) (1e9 + 7);

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException, IOException {
            return br.ready();
        }

    }
}

