#include <bits/stdc++.h>
using namespace std;
long long mark[5010];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(), cout.tie();
  long long t;
  cin >> t;
  while (t--) {
    long long n, s;
    cin >> n >> s;
    long long a[n + 10], b, c = 0, d = 0, e = 0, f = 0, g = 0;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      d += a[i];
    }
    if (d <= s) {
      cout << 0 << endl;
    } else {
      for (long long i = 0; i < n; i++) {
        if (a[i] >= c) {
          g = i;
          c = a[i];
        }
        if (e + a[i] - c <= s) {
          d = g;
        } else
          break;
        e = e + a[i];
      }
      cout << d + 1 << endl;
    }
  }
}
