#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, s;
    cin >> n >> s;
    vector<long long> v;
    long long sum = 0, idx = -1;
    for (long long i = 0; i < n; i++) {
      long long a;
      cin >> a;
      v.push_back(a);
      sum += a;
      if (sum > s && idx == -1) {
        idx = i;
      }
    }
    long long ans = 0;
    if (sum <= s) {
      ans = 0;
    } else {
      long long mx = 0, pos = 0;
      for (long long i = 0; i <= idx; i++) {
        if (v[i] >= mx) {
          mx = v[i];
          pos = i;
        }
      }
      ans = pos + 1;
    }
    cout << ans << endl;
  }
}
