#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define IOS cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
using namespace std;
const int mod = 1e9+7;
int MSB(unsigned x){ //most significant bit-read IEEE 754
	union { double a; int64_t b; };
	a = x;
	return (b >> 20) - 1023;
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

ll bpow(ll a,ll b){ll s=1;while(b){if(b&1)s*=a;a*=a;b>>=1;}return s;}
ll bmpow(ll a,ll b){ll s=1;while(b){if(b&1)s*=a,s%=mod;a*=a;a%=mod;b>>=1;}return s;}

const int N = 1e6+13;
int a[N];
void solve(){
    int n,W;cin>>n>>W;
    multiset<int> g;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n,greater<int>());
    for(int i=0;i<n;i++){
        g.insert(W);
    }
    for(int i=0;i<n;i++){
        int x = a[i];
        int y = *g.lower_bound(x);
        //cout << x << " " << y << endl;
        auto it = g.find(y);
        if(it!=g.end())g.erase(it);
        g.insert(y-x);
    }
    int c = g.count(W);
   // for(auto x:g)cout<<x<<" ";cout<<endl;
    cout << n-c << endl;

}

int main(){
    IOS;
    int t;
    cin>>t;
    while(t--)solve();

}
