#include <iostream>
#include <vector>

struct Data {
    int32_t x, max, op;
    Data(int32_t x_, int32_t max_, int32_t op_) {
        x = x_;
        max = max_;
        op = op_;
    }
};

int main(int argc, char const *argv[]) {
    int32_t t; std::cin >> t;
    while (t--) {
        int32_t n, x; std::cin >> n >> x;
        std::vector<int32_t> array(n);
        for (int32_t i = 0; i < n; ++i) std::cin >> array[i];
        std::vector<std::vector<Data>> possibleX(n);
        possibleX[0] = {{x, array[0], 0}};
        if (x < array[0]) possibleX[0].push_back({array[0], x, 1});
        for (int32_t i = 1; i < n; i++) {
            for (Data data : possibleX[i - 1]) {
                if (data.max <= array[i]) {
                    possibleX[i].push_back({data.x, array[i], data.op});
                }
                if (data.x < array[i] && data.x >= data.max) {
                    possibleX[i].push_back({array[i], data.x, data.op + 1});
                }
            }
        }
        if (possibleX[n - 1].empty()) {
            std::cout << -1 << std::endl;
        } else {
            int32_t min = 228228;
            for (Data data : possibleX[n - 1]) {
                min = std::min(min, data.op);
            }
            std::cout << min << std::endl;
        }
    }
    return 0;
}
