#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  long long arr[n];
  long long sum = 0;
  long long num = 0;
  long long ans = 0;
  map<long long, long long> ma;
  long long maxi = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (long long i = 0; i < n; i++) {
    maxi = max(maxi, arr[i]);
    ma[arr[i]] = i + 1;
    sum += 1LL * arr[i];
    long long x = sum - k;
    if (x <= 0) {
      num = max(num, i + 1);
    } else {
      if (x > maxi) {
        continue;
      }
      auto j = ma.lower_bound(x);
      ans = j->second;
    }
  }
  if (sum <= k) {
    cout << "0\n";
    return;
  }
  cout << ans << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
