#pragma GCC optimize("O3")
#include <bits/stdc++.h>

//#define int long long

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 pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

int n, k;
bool check(vector<int> &a, int t) {
	int rptr = n - t - 1;
	if (rptr < 0) return true;
	if (a[rptr] >= k) return false;
	int lptr = 0;
	int packs = 0;
	while (lptr <= rptr) {
		packs++;
		if (lptr == rptr)
			break;
		rptr--;
		if (a[lptr] + a[rptr+1] >= k) {
			continue;
		}
		lptr++;
	}
	return packs <= t;
}

int solve() {
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(all(a));
	int lo = 0, hi = n;
	while (hi - lo > 1) {
		int mid = (lo + hi) >> 1;
		if (check(a, mid))
			hi = mid;
		else
			lo = mid;
	}
	cout << lo << '\n';
	return 0;
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	int t;
	cin >> t;
	while (t--) solve();
	return 0;
}