/*
    Author @kandarppatel
*/

#include<bits/stdc++.h>
#define io std :: ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define M 1000000007
#define int long long
#define eb emplace_back
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define nl "\n"
#define yy "YES\n"
#define nn "NO\n"
#define PI 3.1415926535897932
using namespace std;


void solve(){
    int n,w;
    cin>>n>>w;

    vector<int>v(n);
    map<int,int,greater<int>>mp;

    for(int i=0;i<n;i++){
        cin>>v[i]; 
        mp[v[i]]++;
    }

    int i = 0 , c = 1, avail = w;
    while(i < n)
    {
        int mx = -1;
        for(auto &x : mp)
        {
            if(x.second > 0 && x.first <= avail){
                mx = x.first;
                break;
            }
        }
        
        if(mx == -1)
        {
            c++;
            avail = w;
            for(auto &x:mp)
            {
                if(x.second > 0 && x.first <= avail){
                    mx = x.first;
                    break;
                }
            }
        }

        mp[mx]--;
        avail -= mx;
        i++;
    }

    cout<<c<<nl;
}   

signed main()
{
    io;
    int t = 1;
    cin>>t;
    while(t--){
        solve();
    }
}