#include <iostream>
#include <bits/stdc++.h>
#define pb push_back
#define all(v) v.begin(),v.end()
#define lli long long int
#define ppb pop_back
#define rep(i,n) for(i=0;i<n;i++)
#define inf INT_MAX
#define ninf INT_MIN
#define fck ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fr first
#define sc second
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,i,j,w;
        cin>>n;
        //map<int,int>m;
        cin>>w;
        int a[n];
        int m[32];
        memset(m,0,sizeof(m));
        rep(i,n)
        {
            cin>>a[i];
            m[int(log2(a[i]))]++;
        }
        int h=0;
        int ww=w;
        //for(i=0;i<32;i++)cout<<m[i]<<endl;
        while(1)
        {
            int f=0;
            w=ww;
            for(i=31;i>=0;i--)
            {
                while(m[i]>0&&(1<<i)<=w)
                {
                    m[i]--;
                    w-=(1<<i);
                    f=1;
                }
            }
            if(f==0)break;
            else h++;
        }
        cout<<h<<endl;

    }
}
