#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; bool checkans(ll n, ll k, vector<ll>& d, int ans) { int emptypairs = ans; int j = 0; for (int i = n - 1 - ans; i >= j; i--) { if (i > j && d[i] + d[j] < k) { j++; emptypairs--; } else if (d[i] < k) { emptypairs--; } else return false; } return emptypairs >= 0; } int main() { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { ll n, k; cin >> n >> k; vector<ll> d(n); for (int i =0; i < n; i++) cin >> d[i]; sort(d.begin(), d.end()); int lo = 1; int hi = n + 1; while (lo < hi) { int mid = (lo + hi) / 2; if (checkans(n, k, d, mid)) { hi = mid; } else { lo = mid + 1; } } cout << lo - 1 << endl; } return 0; }