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

/**
 * @author htdong
 * @date 2018年4月20日 上午11:52:19
 */

public class Main {

    static int[] a = new int[510];

    private static boolean f(int n) {
        for (int i = 1; i < n; ++i) {
            if (a[i] < a[i - 1]) {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int _t = in.nextInt();
        while (_t-- > 0) {
            int n = in.nextInt();
            int x = in.nextInt();
            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
            }
            int ans = 0;
            while (!f(n) && ans <= n) {
                int i = n - 1;
                for (; i >= 0 && a[i] >= x; --i)
                    ;
                ++i;
                for (; i < n && a[i] == x; ++i)
                    ;
                if (i == n) {
                    ans = n + 1;
                    break;
                }
                ++ans;
                int tmp = x;
                x = a[i];
                a[i] = tmp;
            }
            System.out.println(ans <= n ? ans : -1);
        }
        in.close();
    }

    public static int idx(int l, int r) {
        return (l + r) | (l != r ? 1 : 0);
    }

    public static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }

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

    static class TreapNode {
        int key, val;
        int wht, sz;
        TreapNode[] ch;
        private static TreapNode LEAF = null;
        // private static final Random RAND = new Random(System.currentTimeMillis());
        private static int x = 1364684679;

        static int rands() {
            x += (x << 2) + 1;
            return x;
        }

        public static TreapNode leaf() {
            if (LEAF != null) {
                return LEAF;
            }
            LEAF = new TreapNode();
            LEAF.ch = new TreapNode[2];
            LEAF.ch[0] = LEAF.ch[1] = LEAF;
            LEAF.sz = 0;
            LEAF.key = -1;
            LEAF.val = -1;
            LEAF.wht = -2147483648;
            return LEAF;
        }

        private TreapNode() {
        }

        public TreapNode(int key, int val) {
            ch = new TreapNode[2];
            ch[0] = ch[1] = leaf();
            this.key = key;
            this.val = val;
            this.sz = 1;
            this.wht = rands();
        }

        @Override
        public String toString() {
            return "key= " + key + ", val = " + val;
        }
    }

    static class Treap {

        private TreapNode root, leaf;

        public Treap() {
            leaf = TreapNode.leaf();
            root = leaf;
        }

        public void insert(int key, int val) {
            insert(root, key, val, null, 0);
        }

        public void remove(int key) {
            remove(root, key, null, 0);
        }

        public int find(int key) {
            return find(root, key);
        }

        public int findLowerOrEqual(int key) {
            TreapNode rlt = findLowerOrEqual(root, key);
            return rlt == leaf ? -1 : rlt.key;
        }

        public int findUpperOrEqual(int key) {
            TreapNode rlt = findUpperOrEqual(root, key);
            return rlt == leaf ? -1 : rlt.key;
        }

        public int maxKey() {
            TreapNode t = root;
            while (t.ch[1] != leaf) {
                t = t.ch[1];
            }
            return t.key;
        }

        public int size() {
            return root.sz;
        }

        private void insert(TreapNode x, int key, int val, TreapNode px, int pt) {
            if (x == leaf) {
                x = new TreapNode(key, val);
                if (px != null) {
                    px.ch[pt] = x;
                } else {
                    root = x;
                }
                return;
            }
            if (key == x.key) {
                x.val = val;
            } else {
                int son = key < x.key ? 0 : 1;
                insert(x.ch[son], key, val, x, son);
                if (x.wht < x.ch[son].wht) {
                    rotate(x, son, px, pt);
                }
            }
            update(x);
        }

        private void remove(TreapNode x, int key, TreapNode px, int pt) {
            if (x == leaf) {
                return;
            }
            if (x.key == key) {
                if (x.ch[0] == leaf && x.ch[1] == leaf) {
                    if (px == null) {
                        root = leaf;
                    } else {
                        px.ch[pt] = leaf;
                    }
                    return;
                }
                int son = x.ch[0].wht > x.ch[1].wht ? 0 : 1;
                rotate(x, son, px, pt);
                remove(x, key, px == null ? root : px.ch[pt], son ^ 1);
            } else {
                int son = key < x.key ? 0 : 1;
                remove(x.ch[son], key, x, son);
            }
            update(x);
        }

        private int find(TreapNode x, int key) {
            if (x == leaf) {
                return -1;
            }
            if (x.key == key) {
                return x.val;
            }
            return find(x.ch[key < x.key ? 0 : 1], key);
        }

        private TreapNode findLowerOrEqual(TreapNode x, int key) {
            if (x == leaf) {
                return leaf;
            }
            if (x.key == key) {
                return x;
            }
            if (x.key > key) {
                return findLowerOrEqual(x.ch[0], key);
            }
            TreapNode lv = findLowerOrEqual(x.ch[1], key);
            if (lv == leaf || lv.key > key) {
                return x;
            } else {
                return lv;
            }
        }

        private TreapNode findUpperOrEqual(TreapNode x, int key) {
            if (x == leaf) {
                return leaf;
            }
            if (x.key == key) {
                return x;
            }
            if (x.key < key) {
                return findUpperOrEqual(x.ch[1], key);
            }
            TreapNode lv = findUpperOrEqual(x.ch[0], key);
            if (lv == leaf || lv.key < key) {
                return x;
            } else {
                return lv;
            }
        }

        private void update(TreapNode t) {
            t.sz = 1 + t.ch[0].sz + t.ch[1].sz;
        }

        private void rotate(TreapNode x, int t, TreapNode px, int pt) {
            TreapNode s = x.ch[t];
            x.ch[t] = s.ch[t ^ 1];
            s.ch[t ^ 1] = x;
            update(x);
            update(s);
            if (px != null) {
                px.ch[pt] = s;
            } else {
                root = s;
            }
        }
    }
}