#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  for (int i = (0); ((1) > 0 ? i < (t) : i > (t)); i += (1)) {
    ll n, s;
    cin >> n >> s;
    vector<ll> v(n), pref(n + 2);
    for (int i = (0); ((1) > 0 ? i < (n) : i > (n)); i += (1))
      cin >> v[i], pref[i + 1] = v[i] + pref[i];
    pref[n + 1] = pref[n];
    int gr = 0, ans = 0;
    {
      int l = 0, r = n + 1;
      while (l < r) {
        int m = (l + r + 1) / 2;
        if (pref[m] > s) {
          r = m - 1;
        } else {
          l = m;
        }
      }
      gr = l;
    };
    for (int i = (0); ((1) > 0 ? i < (n) : i > (n)); i += (1)) {
      int l = 0, r = n + 1;
      while (l < r) {
        int m = (l + r + 1) / 2;
        if (pref[m] - v[i] > s) {
          r = m - 1;
        } else {
          l = m;
        }
      };
      if (i + 1 < l && l > gr) {
        ans = i + 1;
        gr = l;
      }
    }
    cout << ans << '\n';
  }
}
