#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;


ll sum(ll n)
{
    ll s=0;
    while(n>0)
    {
        s+= n%10;
        n=n/10;

    }
    return s;
}


ll gcd(ll n, ll m )
{
    ll k = n%m;
    while(k!=0)
    {
        n=m;
        m=k;
        k= n%m;
    }

    return m;
}

ll gcdSum(ll n)
{
    ll x = sum(n);
    ll num =gcd(n,x);
    while(num ==1)
    {
        n++;
        if (n%10 !=0)
        {
            x++;
        }
        else
        {
            x-= 8;
        }
        num = gcd(n,x);

        //cout<<n<<" "<<x<<" "<<num<<endl;

    }

    return n;
}



int main() {
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
	//code
	int t;
    cin >> t;
    while(t>0)
    {
        ll n,w;
        cin >> n>>w;

        map<ll,int> mp;
        for(ll i=0;i<n;i++)
        {
            ll wi ;
            cin >> wi;
            mp[wi]++;
        }
        // for(auto x : mp)
        // {
        //     cout<< x.first<<" "<<x.second<<endl;
        // }

        ll h=0;
        
        map<ll,int>  :: iterator it;
        while(!mp.empty())
        {
            h++;
            it = mp.end();
            it--;
            ll wirem =w;
            //cout<<"hi"<<endl;
            
            while(!mp.empty() && wirem>= mp.begin()->first  )
            {
                if(wirem - it->first >=0)
                {
                    wirem -= it->first;
                    it->second--;
                    if(it->second==0)
                    {
                        mp.erase(it->first);
                        if(mp.empty())
                        {
                            break;
                        }
                        it= mp.end();
                        it--;
                        
                        
                        
                    }
                    

                }
                else
                {
                    it--;
                }   

            }
            // for(auto x : mp)
            // {
            //     cout<< x.first<<" "<<x.second<<endl;
            // }
                
            
            // cout<<"       "<<h<<endl;
        }

        cout<<h<<endl;
        t--;
    }
       
    
	return 0;
}