#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep2(i, n, m) for (int i = (n); i < (m); i++) #define rep(i, n) rep2(i, 0, n) void ints(auto& ...ints) { (scanf("%d", &ints), ...); } constexpr int MaxN = 100'005; int n, a[MaxN]; int k; int solve() { ints(n, k); rep(i, n) ints(a[i]); sort(a, a+n, greater{}); int nA = (n + 2) / 3; while (nA < n && a[nA] >= k) nA++; int npairs = 0; int tl = n; for (int i = nA; i < tl; i++) { if (i + 1 < tl && a[i] + a[tl] < k) tl--; npairs++; } int nblocks = max(nA, npairs); return nblocks - 1; } int main() { int t; ints(t); while (t--) { printf("%d\n", solve()); } }