#include <bits/stdc++.h>

using namespace std;
using ll = int64_t;

void solve_tc() {
	int n, k;
	cin >> n >> k;

	multiset<int> vids;

	for (int i = 0; i < n; ++i) {
		int len;
		cin >> len;
		vids.insert(len);
	}

	// cerr << "vv vids\n";
	// for (const auto &len : vids) {
	// 	cerr << len << '\n';
	// }
	// cerr << "^^ vids\n";

	int ret = 0;

	while (!vids.empty()) {
		++ret;
		int total = 0;

		auto first = vids.begin();
		total += *first;
		vids.erase(first);

		if (vids.empty() || total >= k)
			continue;

		auto second = vids.lower_bound(k - total);
		if (second == vids.end() || second == vids.begin())
			second = --vids.end();
		else
			--second;

		total += *second;
		vids.erase(second);

		if (vids.empty() || total >= k)
			continue;

		auto third = --vids.end();
		// total += *third;
		vids.erase(third);
	}
	--ret; // last not counted

	cout << ret << '\n';
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	int t;
	cin >> t;
	for (int i = 0; i < t; ++i) {
		solve_tc();
	}

	return 0;
}