#include<bits/stdc++.h>
using namespace std;
const int maxm=1e6+5;
int t,n,w;
int a[maxm];
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>n>>w;
        for(int i=0 ;i< n ;i++)
            cin>>a[i];
        priority_queue<int,vector<int>,less<int> >q;
        sort(a,a+n);
        q.push(w);
        for ( int i =n-1 ;i>=0 ;i--)
        {
            if(q.top()>=a[i])
            {
                int x=q.top();
                q.pop();
                q.push(x-a[i]);
            }else
            {
                q.push(w-a[i]);
            }
        }
        cout<<q.size()<<"\n";
    }
    return 0;
}
	 			    	 	 	 			  		 	 	   		