#include <iostream>
#include <set>
#include <iterator>
using namespace std;
typedef long long ll;
int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		ll n, w;
		cin >> n >> w;
		multiset<int> s;
		// multiset<int>::iterator j;
		for (int i = 0; i < n; i++)
		{
			int x;
			cin >> x;
			s.insert(x);
		}
		/*	cout << endl;
		for (j = s.begin(); j != s.end(); j++)
			cout << *j << " ";
		cout << endl;*/
		ll space_left = w, count = 1;
		while (!s.empty())
		{
			auto it = s.upper_bound(space_left);
			if (it != s.begin())
			{
				/*if(it==s.end())
				cout<<"its end "<<endl;*/
				it--;

				int x = *it;
				space_left -= x;
				//	cout<<x<<" "<<space_left<<endl;
				s.erase(s.find(x));
			}
			else
			{
				space_left = w;
				count++;
			}
		}
		cout << count << endl;
	}
	return 0;
}