#include <bits/stdc++.h>
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define ninpo ios_base::sync_with_stdio(false);cin.tie(NULL);
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(cntainer) (int)cntainer.size()
#define tc int t;cin>>t;for(int i=0;i<t;++i)
#define ll long long
#define pii pair<int,int>
using namespace std;

void solve()
{
    int n;ll W;
    cin>>n>>W;
    vector<int> wdts(n);
    for (int i = 0; i < n; i++)
    {
        cin>>wdts[i];
    }
    sort(all(wdts));
    reverse(all(wdts));
    int hgt=1; ll tkn=0;
    priority_queue<ll> olemptywidts;
    for (int i = 0; i < n; i++)
    {
        if(tkn+wdts[i]<=W){
            tkn+=wdts[i];
        }
        else if(sz(olemptywidts) && olemptywidts.top()>=wdts[i]){
            ll crntwdt=olemptywidts.top();
            olemptywidts.pop();
            olemptywidts.push(crntwdt-wdts[i]);
        }
        else{
            olemptywidts.push(max((ll)0,W-tkn));
            // dbg(wdts[i])
            tkn=wdts[i];hgt++;
        }
    }
    cout<<hgt<<endl;
}

int main()
{
       #ifndef ONLINE_JUDGE
           freopen("input.txt", "r", stdin);
           freopen("output.txt", "w", stdout);
       #endif
   ninpo;
   tc
    solve();
}
