    #include<bits/stdc++.h>
    using namespace std;
     
    #define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    typedef long long int ll;
    
    ll gcd(ll A, ll B){if(B==0)  return A;else    return gcd(B,A%B);}
    long long binpow(long long a, long long b) {long long res = 1;while (b > 0) {if (b&1)res = res * a;a = a * a;b >>= 1;}return res;}
  
    //********************************************************************************************************************************
     
    ll cnt[3000005];
        
    void solve()
    {
        ll n,w,ans;
        cin>>n>>w;
        
        
        for(int i=0; i<n; i++){
            cin>>ans;
            ++cnt[ans];
        }
        
        ans=0;
        
        while(n){
            ll left = w;
            for(ll i=(1<<21); i>0; i>>=1){
                while(cnt[i]>0 && left>=i){
                    --cnt[i];
                    --n;
                    left -= i;
                }
            }
            ans++;
        }
        
        cout<<ans<<endl;
    }
    
    int main()
    {
        boost

        int t;
        cin>>t;
        
        while(t--)
            solve();
        
        return 0;
    }