#include <bits/stdc++.h>
using namespace std;
long long s, a[100123], sum;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  if (fopen("input.in", "r")) {
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
  }
  int t, n, total, maxidx, ans;
  cin >> t;
  while (t--) {
    maxidx = 1;
    total = 0;
    sum = 0;
    ans = 0;
    cin >> n >> s;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      sum += a[i];
      if (sum <= s) {
        total = i;
      } else if (sum - a[maxidx] <= s) {
        if (total < i) {
          ans = maxidx;
          total = i - 1;
        }
      }
      if (a[i] > a[maxidx]) maxidx = i;
    }
    cout << ans << endl;
  }
  return 0;
}
