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

/*                               I   S   H   M   A   M
                                   R   U   H   A   N
 */
public class Main {

    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {

                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (Exception e) {

            }
            return str;
        }

    }

    static class CustomScanner {

        private final InputStream ins;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        CustomScanner() {
            this(System.in);
        }

        CustomScanner(InputStream in) {
            ins = in;
        }

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = ins.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) {
                return buffer[ptr++];
            } else {
                return -1;
            }
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
                ptr++;
            }
            return hasNextByte();
        }

        public String next() {
            return nextBuilder().toString();
        }

        public StringBuilder nextBuilder() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb;
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public long nextLong() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
                throw new NumberFormatException();
            }
            return (int) nl;
        }

        public String[] nextA(int n) {
            String[] a = new String[n];
            nextA(a, n);
            return a;
        }

        public void nextA(String[] a, int n) {
            nextA(a, 0, n);
        }

        public void nextA(String[] a, int off, int len) {
            for (int i = off; i < off + len; i++) {
                a[i] = next();
            }
        }

        public int[] nextAInt(int n) {
            int[] a = new int[n];
            nextAInt(a, n);
            return a;
        }

        public void nextAInt(int[] a, int n) {
            nextAInt(a, 0, n);
        }

        public void nextAInt(int[] a, int off, int len) {
            for (int i = off; i < off + len; i++) {
                a[i] = nextInt();
            }
        }

        public long[] nextALong(int n) {
            long[] a = new long[n];
            nextALong(a, n);
            return a;
        }

        public void nextALong(long[] a, int n) {
            nextALong(a, 0, n);
        }

        public void nextALong(long[] a, int off, int len) {
            for (int i = off; i < off + len; i++) {
                a[i] = nextLong();
            }
        }

        public double[] nextADouble(int n) {
            double[] a = new double[n];
            nextADouble(a, n);
            return a;
        }

        public void nextADouble(double[] a, int n) {
            nextADouble(a, 0, n);
        }

        public void nextADouble(double[] a, int off, int len) {
            for (int i = off; i < off + len; i++) {
                a[i] = nextDouble();
            }
        }

        public List<Integer> nextLInt(int n) {
            List<Integer> l = new ArrayList<>(n);
            for (int i = 0; i < n; i++) {
                l.add(in.nextInt());
            }
            return l;
        }

        public List<Long> nextLLong(int n) {
            List<Long> l = new ArrayList<>(n);
            for (int i = 0; i < n; i++) {
                l.add(in.nextLong());
            }
            return l;
        }

        public List<Double> nextLDouble(int n) {
            List<Double> l = new ArrayList<>(n);
            for (int i = 0; i < n; i++) {
                l.add(in.nextDouble());
            }
            return l;
        }
    }

    static final InputStream inputStream = System.in;
    static final CustomScanner in = new CustomScanner(inputStream);
    static final PrintWriter out = new PrintWriter(System.out);
    static final FastReader in2 = new FastReader();

    static class Clock {

        protected long start, stop;

        public void start() {
            start = System.currentTimeMillis();
        }

        public void stop() {
            stop = System.currentTimeMillis();
        }

        public String getTime() {
            return ((stop - start) + " ms");
        }
    }

    long gcd(long a, long b) {
        if (a == 0) {
            return Math.abs(b);
        }
        if (b == 0) {
            return Math.abs(a);
        }
        a = Math.abs(a);
        b = Math.abs(b);
        int az = Long.numberOfTrailingZeros(a), bz = Long.numberOfTrailingZeros(b);
        a >>>= az;
        b >>>= bz;
        while (a != b) {
            if (a > b) {
                a -= b;
                a >>>= Long.numberOfTrailingZeros(a);
            } else {
                b -= a;
                b >>>= Long.numberOfTrailingZeros(b);
            }
        }
        return (a << Math.min(az, bz));
    }

    public long pow(long a, long b) {
        if (b == 0) {
            return 1;
        }
        if (b % 2 == 0) {
            return pow(a * a, b / 2);
        } else {
            return a * pow(a, b - 1);
        }
    }

    static boolean isPrimeLong(long n) {
        if (n == 1 || n == 0) {
            return false;
        }

        for (long i = 2; i * i <= n; i++) {
            if (n % i == 0) {
                return false;
            }
        }

        return true;
    }

    public static ArrayList<String> getAllSubSequence(String str) {
        if (str.length() == 0) {
            ArrayList<String> empty = new ArrayList<>();
            empty.add("");
            return empty;
        }

        char ch = str.charAt(0);

        String subStr = str.substring(1);

        ArrayList<String> subSequences = getAllSubSequence(subStr);

        ArrayList<String> res = new ArrayList<>();
        for (String val : subSequences) {
            res.add(val);
            res.add(ch + val);
        }

        res.remove("");

        return res;
    }

    public static void main(String[] args) throws IOException {
        Clock clock = new Clock();
        Solver solver = new Solver();

        clock.start();

        solver.solve();

        clock.stop();
        //System.out.println(clock.getTime());
        out.close();
    }

    static int n = 14;
    static Stack<Integer> sieve = new Stack<>();
    static Integer[] pm = new Integer[n + 1];

    static void normalSieve() {
        sieve.add(2);
        pm[1] = 1;
        for (int i = 3; i * i <= n;i += 2) {
            if (pm[i] == null) {
                sieve.add(i);
                for (int j = i * i; j <= n; j += i) {
                    pm[j] = 1;
                }
            }
        }

        int k = (int) Math.sqrt((double) n);
        if ((k & 1) == 0)k++;
        else k+=2;
        if (k < 3) k=3;
        for (; k <= n; k += 2) {
            if (pm[k] == null) {
                sieve.add(k);
            }
        }
    }

    static class Solver {

        //~~~Start
        public void solve() {
            int t=in.nextInt();
            
            while(t-- !=0){
                int n=in.nextInt();
                int x=in.nextInt();
                
                int[] arr=new int[n];
                int[] temp;
                
                for (int i = 0; i < n; i++)arr[i]=in.nextInt();
                int ans=0;
                int count=0;
                while(true){
                    count++;
                    temp=arr.clone();
                    Arrays.sort(temp);
                    if(Arrays.equals(temp, arr)){
                        break;
                    }else{
                        for (int i = 0; i <n; i++) {
                            if(arr[i]>x){
                                arr[i]=arr[i]^x;
                                x=arr[i]^x;
                                arr[i]=arr[i]^x;
                                ans++;
                                break;
                            }
                        }
                    }
                    if(count==n){
                        break;
                    }
                    
                }
                
                temp=arr.clone();
                Arrays.sort(temp);
                
                if(!Arrays.equals(temp, arr)){
                    out.println("-1");
                }else{
                    out.println(ans);
                }
                out.flush();
            }
            
        }
        //~~~End
       
    }

}
