//#pragma GCC optimize("inline,Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,avx,abm")
#include <bits/stdc++.h>
#define ll long long
#define int ll
typedef double ld;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long mod = 1000000007;
const int N = 30000;

int n, w;
int a[101010];
int h[101010];
void solve() {
    cin >> n >> w;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int j = 1; j <= n; j++)h[j] = w;
    sort(a + 1, a + 1 + n, greater<int>());
    int mx = 0;
    for (int i = 1; i <= n; i++) {
        int l = 0, r = n;
        while (l + 1 < r) {
            int mid = (l + r) / 2;
            if (h[mid] >= a[i])r = mid;
            else l = mid;
        }
        h[r] -= a[i];
        mx = max(mx, r);
    }
    cout << mx << '\n';
}

int32_t main() {
    fast
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}
/**
*/
