#include <iostream> 
#include <string> 
#include <set> 
#include <map> 
#include <stack> 
#include <queue> 
#include <vector> 
#include <utility> 
#include <iomanip> 
#include <sstream> 
#include <bitset> 
#include <cstdlib> 
#include <iterator> 
#include <algorithm> 
#include <array>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <cstdio> 
#include <cctype> 
#include <cmath>
#include <memory>
#include <numeric>
#include <ctime> 
using namespace std;
#define ll long long

const int MAXN = 2e5;
int widths[MAXN], n, w;

bool check(int x) {
	priority_queue<int> t;
	for(int i=0; i<x; i++) {
		t.push(w);
	}
	for(int i=0; i<n; i++) {
		int big = t.top();
		t.pop();
		if(big < widths[i]) return false;
		t.push(big-widths[i]);
	}
	return true;
}

int main() {
	int t;
	cin >> t;
	while(t--) {
		cin >> n >> w;
		for(int i=0; i<n; i++) {
			cin >> widths[i];
		}
		sort(widths, widths+n, greater<int>());
		int l = 1, r = n+1;
		while(l < r) {
			int mid = (l+r)/2;
			if(!check(mid)) {
				l = mid+1;
			}
			else {
				r = mid;
			}
		}
		cout << r << endl;
		for(int i=0; i<n; i++) {
			widths[i] = 0;
		}
	}
}




