#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define endl "\n"
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
const ll INF = (ll)0x3f3f3f3f3f3f3f, MAX = 9e18, MIN = -9e18;
const double PI=acos(-1.0);
const double eps=1e-6;
const ll mod=1e9+7;
const int inf=0x3f3f3f3f;
const int maxn=1e6+10;
const int maxm=100+10;
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) (x&(-x))
using namespace std;
int n,m,k;
int a[maxn];
int sum[maxn];
int vis[maxn];
void run_case(){
    ios;
    int _;
    cin>>_;
    while(_--){
        int w;
        cin>>n>>w;
        for(int i = 1; i<=1e6; i*=2){
        	sum[i] = 0;
        }
        for(int i = 1; i<=n; i++)
        	cin>>a[i],sum[a[i]]++;
        set<int>s;
        for(int i = 1; i<=n; i++)
        	s.insert(a[i]);
        int ans = 0;
        sort(a+1,a+n+1);
        set<int>::iterator it;
        for(int i = n; i>=1; i--){
        	if(sum[a[i]] == 0)
        		continue;
        	ans++;
        	int left = w;
        	left-=a[i];
        	sum[a[i]]--;
        	if(sum[a[i]] == 0)
        		s.erase(a[i]);
        	while(left){
        		it = s.lower_bound(left);
        	//	cout<<left<<" "<<*it<<" "<<ans<<endl;
        		if(*it == left && sum[*it]>0){
        			left-=*it;
        			sum[*it]--;
        			if(sum[*it] == 0)
        				s.erase(*it);
        		}
        		else if(it!=s.begin()){
        			it--;
        			left-=*it;
        			sum[*it]--;
        			if(sum[*it] == 0)
        				s.erase(*it);
        		}
        		else
        			break;
        	}
        }
        cout<<ans<<endl;

    }
}

int main(){
    ios;
    run_case();
}