#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define fast_i_o ios_base::sync_with_stdio(false);cin.tie(NULL);
#define  ff first
#define  ss second
#define  pb push_back
int main()
{
    fast_i_o;
   // freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int t;
    cin>>t;
    while(t--)
    {
        int n,w;
        cin>>n>>w;
        int arr[n];
        for(int i=0;i<n;i++)cin>>arr[i];
        sort(arr,arr+n,greater<int>());
        priority_queue<int>pq;
        int cn=1;
        pq.push(w);
        int i=0;
        while(i<n){
            if(pq.empty())pq.push(w),cn++;
            else{
                if(pq.top()>=arr[i]){
                    int a=pq.top();pq.pop();
                    pq.push(a-arr[i]);
                }
                else{
                    cn++;
                    pq.push(w-arr[i]);
                }
            }
            i++;
        }
        cout<<cn<<"\n";
    }

}