#include <bits/stdc++.h>
using namespace std;
int del_x[4] = {-1, 1, 0, 0};
int del_y[4] = {0, 0, 1, -1};
int XX[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int YY[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
void solve() {
  int n, s;
  cin >> n >> s;
  int a[n];
  long long int prefix[n];
  int maxs[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i == 0) {
      prefix[i] = a[i];
      maxs[i] = a[i];
    } else {
      prefix[i] = a[i] + prefix[i - 1];
      maxs[i] = max(a[i], maxs[i - 1]);
    }
  }
  int low = 0, high = n;
  int ans;
  while (low <= high) {
    int mid = low + (high - low) / 2;
    if (mid < n && (prefix[mid] <= s || prefix[mid] - maxs[mid] <= s)) {
      low = mid + 1;
      ans = mid;
    } else {
      high = mid - 1;
    }
  }
  int mx = INT_MIN;
  int part = -1;
  for (int i = 0; i <= ans && i < n; i++) {
    if (a[i] > mx) {
      mx = a[i];
      part = i + 1;
    }
  }
  if (prefix[ans] <= s)
    cout << 0 << "\n";
  else
    cout << part << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
