#include <bits/stdc++.h> using namespace std; const int c=200005; int n, k, par, t[c]; bool kesz[c]; void solve() { cin >> n >> k; for (int i=1; i<=n; i++) { cin >> t[i]; } sort(t+1, t+n+1); int pos=n; for (int i=1; i<=n; i++) { while (pos>0 && (kesz[pos] || t[i]+t[pos]>=k)) pos--; if (pos>i) { par++; kesz[i]=1, kesz[pos]=1; } } int rem=n-2*par; //cout << "valasz........ "; cout << max(rem-1, (n-1)/3) << "\n"; par=0; for (int i=0; i<=n; i++) { kesz[i]=0; } } int main() { ios_base::sync_with_stdio(false); int w; cin >> w; while (w--) { solve(); } return 0; }