#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n, s;
    cin >> n >> s;
    int max_num = -1;
    int res;
    int max_id = 0;
    int c1 = 0, c2 = -1;
    for (int j = 0; j < n; j++) {
      int a;
      cin >> a;
      s -= a;
      if (a > max_num) {
        max_id = j + 1;
        max_num = a;
      }
      if (s >= 0) c1++;
      if (s < 0 && c2 == -1) {
        c2 = c1;
        c1--;
        s += max_num;
        res = max_id;
      }
    }
    if (s >= 0 && c2 == -1)
      cout << 0 << "\n";
    else
      cout << res << "\n";
  }
  return 0;
}
