#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(c) (c).begin(), (c).end()

void solve() {
    int n, W;
    cin >> n >> W;

    multiset <int> S;
    int w;
    for (int i = 0; i < n; i++) {
        cin >> w;
        S.insert(w);
    }

    int lvl = 1, space_left = W;
    while (!S.empty()) {
        auto it = S.upper_bound(space_left);
        if (it != S.begin()) {
            it--;
            space_left -= (*it);
            S.erase(it);
        }
        else {
            lvl++;
            space_left = W;
        }
    }
    cout << lvl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        solve();
        cout << '\n';
    }
    return 0;
}