#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
int binomial(int n, int k) {
  if (k == 0 || k == n) return 1;
  return binomial(n - 1, k - 1) + binomial(n - 1, k);
}
vector<long long> factor;
vector<long long> prime(long long n) {
  for (long long d = 2; d * d <= n; d++) {
    while (n % d == 0) {
      factor.push_back(d);
      n /= d;
    }
  }
  if (n > 1) factor.push_back(n);
  return factor;
}
pair<int, int> fib(int n) {
  if (n == 0) return {0, 1};
  auto p = fib(n >> 1);
  int c = p.first * (2 * p.second - p.first);
  int d = p.first * p.first + p.second * p.second;
  if (n & 1)
    return {d, c + d};
  else
    return {c, d};
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int s;
    cin >> s;
    int a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    int m = 0;
    int l = 0;
    int g = 0;
    int h = 0;
    for (int i = 0; i < n; i++) {
      l += a[i];
      if (a[i] > m) {
        m = a[i];
        g = i + 1;
      }
      if (l > s) {
        l -= m;
        h = g;
        break;
      }
    }
    cout << h << endl;
  }
}
