#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, s;
    cin >> n >> s;
    long long a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    long long ans = 0, sum = 0, m = 0;
    for (long long i = 0; i < n; i++) {
      if (a[i] > a[m]) m = i;
      sum = sum + a[i];
      if (sum > s && sum - a[m] <= s) ans = m + 1;
    }
    cout << ans << endl;
  }
}
