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

public class test {

    static Scanner s=new Scanner(System.in);
    public static void main (String[] args) {
        //code

        int t=s.nextInt();
  ans(t);
//        while(t>0){
//            //System.out.println("---------------");
//            t--;
//            long x=s.nextInt();
//
//            long f = (-1+(long)Math.pow((1+8*x),.5))/2;
//           // System.out.println(f);
//
//            long ans = f;
//            if((f*(f+1))/2==x){
//                System.out.println(f);
//                continue;
//            }
//
//            long xx = (f*(f+1))/2-(x-(f+1))+1;
//            //System.out.println(xx);
//            long yy = ((f+1)*(f+2))/2-x+1;
//
//            long gg = Integer.MAX_VALUE;
//            if(x>=3)
//                gg=x-1;
//            //System.out.println(ans+" "+xx+" "+yy+" "+gg);
//            ans+=Math.min(xx,yy);
//            ans=Math.min(ans,gg);
//            System.out.println(ans);
//
//
//
//        }


    }






    public static void ans(int t){

        while(t>0){
            t--;

            int n = s.nextInt(),x=s.nextInt();
            int a[]=new int[n];
            int max = Integer.MIN_VALUE;
            for(int i=0;i<n;i++){
                a[i]=s.nextInt();
            max = Math.max(max,a[i]);}
            max=Math.max(max,x);
            int l=-1;
            int ans = 0;

            while(true){
                int ff=l;
                boolean d=true;
                for(int i=1;i<n;i++){
                    if(a[i-1]>a[i])
                    {
                        d=false;
                        break;
                    }
                }
                if(d)
                    break;
            for(int i=l+1;i<n;i++){
                 d = c(a,i,x);
                if(d){
                    l=i;
                }
            }

            if(l==ff){
                break;
            }
            ans++;
            int tt=a[l];
            a[l]=x;
            x=tt;

            }
            boolean d=true;
            for(int i=1;i<n;i++){
                if(a[i-1]>a[i])
                {
                    d=false;
                    break;
                }
            }
            if(d)
                System.out.println(ans);
            else
                System.out.println(-1);


        }


    }

    static boolean c(int a[],int i,int x){
        boolean d=true;
        for(int j=0;j<i;j++){
            if(a[j]>a[i] || a[j]>x)
                d=false;
        }
        return d;
    }

    public static int ans(int dp[][][],int i,int n,int x,int a[],int k){
        boolean d=true;
        for(int j=1;j<n;j++){
            if(a[j]<a[j-1]){
                d=false;
                break;
            }
        }
        if(d)
            return 0;
        if(i==n)
            return Integer.MAX_VALUE;
        if(dp[i][x][k]!=-1)
            return dp[i][x][k];

        int min=Integer.MAX_VALUE;
        dp[i][x][k]=min;

        for(int j=0;j<n;j++){
            if(a[j]>x ){
                int tt = a[j];
                a[j]=x;
                min=Math.min(min,ans(dp,j,n,tt,a,x));
                a[j]=tt;
            }
        }
        if(min!=Integer.MAX_VALUE)
            min++;
        dp[i][x][k]=min;
        return min;


    }



    static boolean pow2(int x){
        boolean dd= true;
        for(int i=0;i<bb.size();i++){
            if(x%bb.get(i)==0){
                dd=false;break;
            }
        }
        return dd;
    }
    static ArrayList<Integer> bb;

    static void ans123(int t){
        while(t>0){
            t--;
            int n=s.nextInt();
            int a[]=new int[n],b[]=new int[n];
            for(int i=0;i<n;i++)
                a[i]=s.nextInt();
            for(int i=0;i<n;i++)
                b[i]=s.nextInt();
            ArrayList<pair> x = new ArrayList<>();
            for(int i=0;i<n;i++){
                x.add(new pair(a[i],b[i]));
            }
//
//            if(n==1){
//                System.out.println(Math.min(a[0],b[0]));
//                continue;
//            }

            Collections.sort(x,new sorti());
            int prev= 0;
            long sum[]=new long[n];



            for(int i=1;i<n;i++)
                sum[i]=sum[i-1]+x.get(i-1).b;

            long ans = Integer.MAX_VALUE;
            for(int i=0;i<n;i++){

                ans=Math.min(ans,Math.max(x.get(i).a,sum[i]));


            }
            if(ans>sum[n-1]+x.get(n-1).b)
                ans = sum[n-1]+x.get(n-1).b;
            System.out.println(ans);


        }
    }


    static class sorti implements Comparator<pair>{
        @Override
        public int compare(pair a,pair b){
            if(a.a>b.a)
                return -1;
            if(b.a==a.a){
                if(a.b>b.b)
                    return -1;
                return 1;
            }
            return 1;

        }
    }
    static class pair{
        int a,b;
        pair(int a,int b){
            this.a=a;this.b=b;
        }
    }

    static int gcd(int a, int b)
    {
        // Everything divides 0
        if (a == 0)
            return b;
        if (b == 0)
            return a;

        // base case
        if (a == b)
            return a;

        // a is greater
        if (a > b)
            return gcd(a-b, b);
        return gcd(a, b-a);
    }

    static class pq implements Comparator<int[]>{
        @Override
        public int compare(int a[],int b[]){
            return a[2]-b[2];
        }
    }

    public static void queue(){
        PriorityQueue<int[]> pq = new PriorityQueue<>(new pq());
        int b[]={1};
        int i=1,j=1;
        int a[]={i,j,b[0]};
        pq.add(new int[]{i, j});
    }

    public static void stack(){
        Stack<Integer> s= new Stack<Integer>();
    }

    public static int justMax(int a[],int n,int x){
        int l=0,r=n-1;
        int ans= -1;
        while(l<=r){
            int m=(l+r)/2;

            if(a[m]>x){
                ans= m;
                r=m-1;
            }
            else{
                l=m+1;
            }
        }
        return ans;
    }

    public static int justMin(int a[],int n,int x){
        int l=0,r=n-1;
        int ans= -1;
        while(l<=r){
            int m=(l+r)/2;
            if(a[m]>x){
                r=m-1;
            }else{
                l=m+1;
                ans=m;
            }
        }
        return ans;
    }

    public static void quickSort(int a[],int  n,int l,int r){
        if(l>=r)
            return;
        int p=l;
        for(int i=l+1;i<=r;i++){
            if(a[i]<a[p]){
                int t=a[i];
                a[i]=a[p+1];
                a[p+1]=t;
                t=a[p];a[p]=a[p+1];a[p+1]=t;p++;
            }
        }
        quickSort(a,n,l,p-1);
        quickSort(a,n,p+1,r);

    }

    public static void mergeSort(int a[],int n,int l,int r){
        if(l>=r)
            return ;
        int m=(l+r)/2;
        mergeSort(a,n,l,m);
        mergeSort(a,n,m+1,r);
        merge(a,n,l,r,m);

    }

    public static void merge(int a[],int n,int l,int r,int m){
        int i=l,j=m+1;
        int b[]=new int[m-l+1];
        int c[]=new int[r-m];
        for(int k=0;k<m-l+1;k++)
            b[k]=a[k+l];
        for(int k=0;k<r-m;k++)
            c[k]=a[m+1+k];
        int k=l;i=0;j=0;
        while(i<m-l+1&&j<r-m){
            if(c[j]>b[i]){
                a[k] = b[i];
                i++;
            }
            else{
                a[k]=c[j];j++;
            }
            k++;
        }
        while(i< m-l+1){
            a[k]=b[i];i++;k++;
        }
        while(j<r-m){
            a[k]=c[j];j++;k++;
        }
    }
}
