#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, k;
  long long t;
  cin >> t;
  while (t--) {
    long long n, s;
    cin >> n >> s;
    vector<long long> v(n);
    for (i = (0); i < (n); i++) cin >> v[i];
    long long cs = 0;
    priority_queue<pair<long long, long long> > pq;
    long long count = 0, index = -1;
    for (i = (0); i < (n); i++) {
      pq.push(make_pair(v[i], i));
      cs += v[i];
      if (cs > s) {
        long long top = (pq.top()).first;
        if ((cs - top) > s)
          break;
        else {
          if (i >= count) {
            count = i;
            index = (pq.top()).second;
          }
        }
      } else {
        if ((i + 1) >= count) {
          count = (i + 1);
          index = -1;
        }
      }
    }
    cout << index + 1 << '\n';
  }
  return 0;
}
