#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;

void solve() {
    ll n, c;
    cin >> n >> c;
    
    // Use vector instead of VLA to prevent stack overflow
    vector<ll> b(n + 1, 0);
    ll sum = 0;
    
    for (ll i = 1; i <= n; i++) {
        cin >> b[i];
        sum += b[i];
    }
    
    // Sort from index 2 to n
    sort(b.begin() + 2, b.end());
    
    ll answer = 0;
    
    // Precompute prefix sums for the sorted region to achieve O(1) range queries
    vector<ll> pref(n + 1, 0);
    for (ll i = 2; i <= n; i++) {
        pref[i] = pref[i - 1] + b[i];
    }
    
    // Single loop: O(N) instead of O(N^2)
    for (ll do_it = 1; do_it <= n - 1; do_it++) {
        // 1. Sum of the smallest 'do_it' elements starting from index 2
        ll sum_low = pref[1 + do_it]; 
        ll u1 = (sum - sum_low) * sum_low;
        
        // 2. Sum of the largest 'do_it' elements ending at index n
        ll sum_high = pref[n] - pref[n - do_it];
        u1 = min(u1, (sum - sum_high) * sum_high);
        
        if (u1 <= c) {
            answer = do_it;
        }
    }
    
    cout << n - answer << "\n";
}

int main() {
    // Fast I/O optimization
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}