#include <bits/stdc++.h>
#define int long long
#define ll long long
#define sz(x) (int)(x).size()
#define all(x) begin(x),end(x)
#define rep(i,a,b) for (int i=(a);i<(b);i++)
using namespace std;

string to_string (string s) {return s; }
template <typename T> string to_string(T v) {
    bool first = true;
    string res = "[";
    for (const auto & x : v) {
        if (!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "]";
    return res;
}

void dbg_out() { cout << endl;} 
template <typename Head, typename... Tail> void dbg_out(Head H, Tail... T) {
    cout << ' ' << to_string(H);
    dbg_out(T...);
}

#ifdef DEBUG
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

void solve() {
    int n, k;
    cin >> n >> k;

    multiset<int> ls{};
    for (int i = 0; i < n; i++) {
        int v;
        cin >> v;
        ls.insert(v);
    }

    int ans = 0;
    while (!ls.empty()) {
        int mn = *ls.begin();
        ls.erase(ls.begin());

        if (ls.empty()) {
            break;   
        }
        // mn + truc < k => truc < k - mn
        int ub = k - mn;
        auto it = ls.lower_bound(k - mn);
        if (it != ls.begin()) {
            ls.erase(prev(it));
            if (!ls.empty()) {
                ans++;
                ls.erase(prev(ls.end()));
            }
        } else {
            if (mn >= k)
                ans++;
        }
    }

    cout << ans << '\n';
}

signed main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--) {
        solve();
    }
}