#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
using namespace std;
vector<long long> tree;
long long get_sum(long long v, long long tl, long long tr, long long l,
                  long long r) {
  if (r <= tl || l >= tr) {
    return 0;
  } else if (tl >= l && tr <= r) {
    return tree[v];
  } else {
    long long tm = (tl + tr) / 2;
    return get_sum(v * 2, tl, tm, l, r) + get_sum(v * 2 + 1, tm, tr, l, r);
  }
}
void update(long long v, long long tl, long long tr, long long pos,
            long long x) {
  if (tl == tr - 1) {
    tree[v] = x;
  } else {
    long long tm = (tl + tr) / 2;
    if (pos < tm) {
      update(v * 2, tl, tm, pos, x);
    } else {
      update(v * 2 + 1, tm, tr, pos, x);
    }
    tree[v] = tree[v * 2] + tree[v * 2 + 1];
  }
}
void solve() {
  long long n, s;
  cin >> n >> s;
  tree.clear();
  tree.resize(4 * n);
  vector<long long> num(n);
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> num[i];
    sum += num[i];
    update(1, 0, n, i, num[i]);
  }
  if (sum <= s) {
    cout << "0\n";
    return;
  }
  long long ans = 0, ind = 0;
  for (long long i = 0; i < n; i++) {
    update(1, 0, n, i, 0);
    long long l = -1, r = n;
    while (r - l > 1) {
      long long m = (r + l) >> 1;
      if (get_sum(1, 0, n, 0, m + 1) <= s)
        l = m;
      else
        r = m;
    }
    if (l < i) {
      if (l + 1 > ans) {
        ans = l + 1;
        ind = i;
      }
    } else if (l >= i) {
      if (l > ans) {
        ans = l;
        ind = i;
      }
    }
    update(1, 0, n, i, num[i]);
  }
  cout << ind + 1 << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
