#include<bits/stdc++.h>

#define f first
#define s second
#define all(x) (x).begin(),(x).end()
#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int t;
    cin >> t;
    while(t--){
        int n,k;
        cin >> n >> k;
        multiset<int> s;
        int ans=-1;
        for(int i=0;i<n;i++){
            int x;
            cin >> x;
            s.insert(x);
        }
        while(sz(s)){
            ans++;
            int mn=*s.begin();
            s.erase(s.begin());
            if(mn>=k){
                continue;
            }
            if(sz(s)==0)break;
            int drugi=k-mn-1;
            auto it=s.lower_bound(drugi+1);
            if(it==s.begin()){
                // cannot pick 2 without watching ad
                int mx=*s.rbegin();
                s.erase(s.find(mx));
                continue;
            }
            it--;
            int d=*it;
            s.erase(it);
            assert(d+mn<k);
            if(sz(s)){
                int mx=*s.rbegin();
                s.erase(s.find(mx));
            }
        }
        cout << ans << endl;
    }
}