#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, s, ans = 0, maxs = 0, i;
  cin >> n >> s;
  bool used = false;
  vector<long long> a(n);
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (!used && a[i] > maxs) {
      maxs = a[i];
      ans = i + 1;
    }
    if (s - a[i] >= 0) {
      s -= a[i];
    } else if (s + maxs - a[i] >= 0) {
      s -= a[i];
      used = true;
    } else {
      break;
    }
  }
  for (; i + 1 < n; i++) {
    cin >> a[i];
  }
  cout << (used == true ? ans : 0) << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) solve();
}
