#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long int
const int M = 1e9+7;

ll solve(ll arr[], ll n, ll w){
  multiset<int> s;
  for(int i=0; i<n; i++)
    s.insert(arr[i]);

  int curr = 0, count = 0;
  while(!s.empty()){
    if(curr == 0){
      curr = w;
      count++;
    }
    // find just smaller or equal to 'curr'
    // and erase it from 's'
    auto it = s.lower_bound(curr);
    if(it != s.end() and *it == curr){
      curr = 0;
      s.erase(it);
    }
    else if(*s.begin() > curr){
      curr = 0;
      continue;
    }
    else{
      --it;
      curr -= *it;
      s.erase(it);
    }
  }

  return count;
}


int main(){
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
#ifndef ONLINE_JUDGE
 // for getting input from input.txt
 freopen("input.txt", "r", stdin);
 // for writing output to output.txt
 freopen("output.txt", "w", stdout);
#endif
  
 int t;
 cin>>t;
 for(int z=1; z<=t; z++){
    ll n, w;
    cin>>n>>w;
    ll arr[n];
    for(int i=0; i<n; i++)
      cin>>arr[i];
    ll ans = solve(arr, n, w);
    cout<<ans<<endl;
 }

return 0;
}