#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<sstream>
#include<stack>
#include<set>
#include<bitset>
#include<vector>
#define ll long long
#define ull unsigned long long
#define up_b upper_bound
#define low_b lower_bound
#define m_p make_pair
#define mem(a) memset(a,0,sizeof(a))
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF 0x3f3f3f3f
#define endl '\n'
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
const ll mod=1e9+7;
inline int lowbit(int x){return x&(-x);}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
void ex_gcd(ll a,ll b,ll &d,ll &x,ll &y){if(!b){d=a,x=1,y=0;}else{ex_gcd(b,a%b,d,y,x);y-=x*(a/b);}}//x=(x%(b/d)+(b/d))%(b/d);
inline ll qpow(ll a,ll b,ll MOD=mod){ll res=1;a%=MOD;while(b>0){if(b&1)res=res*a%MOD;a=a*a%MOD;b>>=1;}return res;}
inline ll read(){ ll f = 1; ll x = 0;char ch = getchar();while(ch>'9'||ch<'0') {if(ch=='-') f=-1; ch = getchar();}while(ch>='0'&&ch<='9') x = (x<<3) + (x<<1) + ch - '0',  ch = getchar();return x*f; }
//inline ll Inverse(ll x) { return qpow(x,mod-2);}
//inline ll C(ll n,ll m) { return fact[n]*inv[m]%mod*inv[n-m]%mod;}
double round(double r){return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);}//四舍五入
const int maxn=1e5+5;
//const int dx[]={-1,0,1,0};
//const int dy[]={0,1,0,-1};
//ll fact[105];
//ll inv[105];
ll w[maxn];
ll pow2[35];
map<ll,ll>mp;

void init()
{
	pow2[0]=1;
	rep(i,1,30) pow2[i]=pow2[i-1]*2;
}

int main()
{
	//IOS;
	//fact[0]=inv[0]=1;
	//rep(i,1,100) fact[i]=(ll)i*fact[i-1]%mod,inv[i]=Inverse(fact[i]);
	init();
	int _;_=read();while(_--)
	{
		ll n=read(),W=read(),h=0;
		rep(i,1,n)
		{
			ll temp=read(),p=0;
			while(temp!=1)
			{
				temp/=2;
				p++;
			}
			mp[p]++; 
		} //w[i]=read(),mp[w[i]]++;
		//sort(w+1,w+1+n);
		//h=1;tmp=W-w[n];mp[w[n]]--;
		int x=0;
		for(h=1;x<n;h++)
		{
			ll now=W;
			for(int j=30;j>=0;j--)
			{
				while(mp[j]>0&&now>=pow2[j])
				{
					mp[j]--;
					now-=pow2[j];
					x++;
					//cout<<now<<endl;
				}
			}
		}
		printf("%lld\n",h-1);
		mp.clear();
	}
}



