#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() #define F first #define S second #define MP make_pair typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int t; cin >> t; rep(blblb, 0, t) { int n; ll k; cin >> n >> k; vl vecvals(n); for (auto &v : vecvals) cin >> v; std::sort(all(vecvals)); list<ll> vals(all(vecvals)); auto b = vals.begin(); int cnt = 0; while (!vals.empty()) { auto a = vals.begin(); auto c = prev(vals.end()); while (b != c && next(b) != c && *a + *next(b) < k) b++; if (a == c || *a >= k) { vals.erase(a); } else { if (a == b) { b++; vals.erase(a); vals.erase(c); } else if (b == c) { b--; vals.erase(a); vals.erase(c); } else { b++; vals.erase(prev(b)); vals.erase(a); vals.erase(c); } } cnt++; } cout << (cnt - 1) << '\n'; } }