#include <bits/stdc++.h>
using namespace std;
long long a[100005];
signed main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    long long s;
    scanf("%d%lld", &n, &s);
    long long sum = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%lld", &a[i]);
      sum += a[i];
    }
    if (sum <= s) {
      printf("0\n");
      continue;
    }
    long long mx = 0, now = 0, ansid = 0, mxid = 0;
    for (int i = 1; i <= n; i++) {
      now += a[i];
      if (mx <= a[i]) {
        mxid = i;
        mx = a[i];
      }
      if (now - mx <= s) {
        ansid = mxid;
      }
    }
    printf("%lld\n", ansid);
  }
}
