#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const long long INF = numeric_limits<long long>::max();
vector<long long> readVec(long long n) {
  vector<long long> result;
  result.resize(static_cast<std::size_t>(n));
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    result[static_cast<std::size_t>(i)] = a;
  }
  return result;
}
void solve() {
  long long n, s;
  cin >> n >> s;
  vector<long long> values = readVec(n);
  long long sum = accumulate(values.begin(), values.end(), 0LL);
  if (sum <= s) {
    cout << 0 << endl;
    return;
  }
  vector<long long> prefixSum;
  long long total = 0;
  for (auto a : values) {
    total += a;
    prefixSum.push_back(total);
  }
  long long bestVal = distance(
      prefixSum.begin(), upper_bound(prefixSum.begin(), prefixSum.end(), s));
  long long bestRes = 0;
  long long pos = 0;
  long long su = 0;
  long long maxVal = 0;
  long long maxIndex = 0;
  while (su < s) {
    su += values[pos];
    if (values[pos] > maxVal) {
      maxVal = values[pos];
      maxIndex = pos;
    }
    pos++;
  }
  if (values[pos] >= maxVal) {
    cout << 0 << endl;
    return;
  }
  cout << maxIndex + 1 << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  cin >> t;
  for (int i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
