#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    int n, s;
    cin >> n >> s;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int pos = -1;
    int i;
    for (i = 0; i < n; i++) {
      if (pos == -1 || a[i] > a[pos]) pos = i;
      if (a[i] <= s) {
        s -= a[i];
      } else
        break;
    }
    if (i == n)
      cout << 0 << '\n';
    else
      cout << pos + 1 << '\n';
  }
  return 0;
}
