#include <bits/stdc++.h>
using namespace std;
int solve(int s, vector<int> &v) {
  int curmaxindex = 0;
  int prevmaxindex = 0;
  long long sum = 0;
  int sz = v.size();
  for (int i = 0; i < sz; ++i) {
    sum += v[i];
    if (v[i] > v[curmaxindex]) {
      prevmaxindex = curmaxindex;
      curmaxindex = i;
    }
    if (sum > s && sum - v[curmaxindex] <= s) {
      return curmaxindex + 1;
    }
  }
  return 0;
}
int main() {
  int t;
  cin >> t;
  vector<int> responses;
  for (int i = 0; i < t; ++i) {
    int n, s;
    cin >> n >> s;
    vector<int> v;
    for (int j = 0; j < n; ++j) {
      int tmp;
      cin >> tmp;
      v.push_back(tmp);
    }
    responses.push_back(solve(s, v));
  }
  for (auto i : responses) {
    cout << i << endl;
  }
  return 0;
}
