#include <bits/stdc++.h>

using namespace std;
using ll = int64_t;

int main() {

    int t;
    cin >> t;

    while(t--){

        int n, w;
        cin >> n >> w;

        vector<int> v(n);

        for(int &i : v) cin >> i;

        multiset<int> s;
        sort(v.begin(), v.end(), greater<int>());

        int ans = 0;

        for(int i = 0; i < n; i++){
            if(s.size() == 0){
                ans++;
                int space = w - v[i];
                if(space) s.insert(space);
            } else {
                auto itr = --s.end();
                int can = *itr;
                if(can >= v[i]){
                    s.erase(itr);
                    int space = can - v[i];
                    if(space) s.insert(space);
                }
                else {
                    ans++;
                    int space = w - v[i];
                    if(space) s.insert(space);
                }
            }
        }

        cout << ans << endl;

    }

    return 0;
}
