#include<iostream>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<algorithm>
#include<stdlib.h>
using namespace std;
const int maxn = 1e6+10;
int a[maxn];
long long n, w;
bool cmp(int x, int y) {
    return x > y;
}
int  solve(){
	long long tmp = 0;
    	priority_queue<long long> p;
        p.push(w - a[1]);
        for (int i = 2; i <= n; i++) {
            tmp = p.top();
            if (tmp >= a[i]) {
                p.pop();
                p.push(tmp - a[i]);
            } else  {
               p.push(w-a[i]);
            }
        }
        return p.size();
}
int main() {
    int T;
    cin >> T;
    while (T--) {
        cin >> n >> w;
        for (int i = 1; i <= n; i++)
            cin >> a[i];
        sort(a + 1, a + 1 + n, cmp);
        cout << solve() << endl;
    }
}
