#include "bits/stdc++.h" using namespace std; #define int long long #define ld long double #define ll long long #define st first #define nd second #define pb push_back #define eb emplace_back #define sz(x) (int)(x).size() #define all(x) begin(x),end(x) #define FOR(i,l,r) for(int i = (l); i <= (r); i++) #define ROF(i,r,l) for (int i = (r); i >= (l); i--) auto& operator<<(auto&o, pair<auto,auto>p) { return o << "(" << p.st << ", " << p.nd << ")"; } auto operator<<(auto&o, auto x)->decltype(end(x), o) { o << "{"; int i =0; for (auto e : x) o << ","+!i++ << e; return o << "}"; } #ifdef LOCAL #define debug(x...) cerr << "[" #x "]: ", [](auto...$) { \ ((cerr << $ << "; "), ...) << endl; }(x) #else #define debug() {} #endif #define rep(i, a, b) for (int i = (a); i < (b); i++) using pii = pair<int, int>; using vi = vector<int>; const int inf = 1e9 + 7; const int N = 2e3 + 5; int n, k; int w; multiset<int> s; signed main() { cin.tie(0)->sync_with_stdio(0); int tt; cin >> tt; while(tt--){ cin >> n >> k; s.clear(); for(int i=0;i<n;i++){ cin >> w; s.insert(w); } int ans = 0; while(s.size()){ ans++; int v = *s.begin(); s.erase(s.begin()); if(v >= k) continue; if(s.size()){ s.erase(s.find(*s.rbegin())); if(s.size()){ auto it = s.lower_bound(k-v); if(it == s.begin()){ continue; } it = prev(it); s.erase(it); } } } cout << ans-1 << "\n"; } return 0; }