#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define xx first
#define yy second
 
#define pii pair <int, int >
#define pll pair < ll, ll >
#define xx first
#define yy second
#define vi vector < int >
#define vl vector < ll >
#define vp vector < pii >
 
 
 
#define f(i, c, n) for(int i = c; i < n; i++)
#define fe(i, c, n) for(int i = c; i <= n; i++)
#define fr(i, n, c) for(int i = n - 1; i >= c; i--)
 
#define be(a) a.begin(), a.end()
#define rbe(a) a.rbegin(), a.rend()
#define vsort(a) sort(a.begin(), a.end())
#define mem(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define srti(a, n) sort(a, a + n)
#define srtd(a, n) sort(a, a + n, greater<int>())
#define LB(a, x) (lower_bound(be(a), x) - a.begin())
#define UB(a, x) (upper_bound(be(a), x) - a.begin())
#define S " "
#define N "\n"
 
bool checkBit(ll n, ll i){ return (n&(1LL<<i)); }
ll setBit(ll n, ll i){ return (n|(1LL<<i)); }
ll resetBit(ll n, ll i){ return (n&(~(1LL<<i))); }
 
#define si(a) scanf("%d", &a)
#define sl(a) scanf("%lld", &a)
#define sii(a, b) scanf("%d %d", &a, &b)
#define sll(a, b) scanf("%lld %lld", &a, &b)
 
//cout << "Case " << ++cs << ": " <<
#define fast ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FILE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

#define SZ 100003

map < int, int > m;

void solve() {
    int n; ll w;
    cin >> n >> w;
    ll arr[n + 2];
    f(i, 0, n) {
        cin >> arr[i];
    }
    set < int, greater<int>> s;
    sort(arr, arr + n, greater<int>());
    ll sum = 0;
    int cnt = 1, flag = 0;
    for(int i = 0; i < n; i++) {
        auto it = s.begin();
        if(*it >= arr[i]) {
            m[*it]--;
            m[(*it - arr[i])]++;
            s.insert((*it) - arr[i]);
            if(m[*it] == 0) {
                s.erase(*it);
            }
            continue;
        }
        sum += arr[i];
        if(flag == 1) {
            flag = 0;
            cnt++;
        }
        if(sum > w) {
            s.insert(w - (sum - arr[i]));
            m[w-(sum - arr[i])]++;
            sum = arr[i];
            cnt++;
        } else if(sum == w) {
            sum = 0;
            flag = 1;
        }
    }
    cout << cnt << N;
    m.clear();
}

int main() {
    // FILE;
    fast;
    int t; cin >> t; while(t--)
    solve();
}