#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, s;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> n >> s;
    long long int maxm = -1, sum = 0, ans = 0, x, idx;
    bool flag = true;
    bool flag1 = true;
    for (int j = 0; j < n; j++) {
      cin >> x;
      sum += x;
      if (x > maxm) {
        maxm = x;
        idx = j + 1;
      }
      if (sum > s) {
        if (flag) {
          sum -= maxm;
          flag = false;
          ans = idx;
        } else {
        }
      }
    }
    if (flag) {
      cout << 0 << endl;
    } else {
      cout << ans << endl;
    }
  }
  return 0;
}
