#include <bits/stdc++.h>
using namespace std;
long long a[100005], s;
int n, t;
int main() {
  cin >> t;
  while (t--) {
    cin >> n >> s;
    for (int i = 0; i < n; i++) cin >> a[i];
    int i = 0;
    long long S = s;
    while (i < n && s >= a[i]) {
      s -= a[i];
      i++;
    }
    if (i == n)
      cout << "0\n";
    else {
      if (i == 0)
        cout << "1\n";
      else {
        int m = 0;
        for (int j = 0; j <= i; j++)
          if (a[j] > a[m]) m = j;
        if (m == i)
          i++;
        else
          s += a[m];
        if (i < n && a[i] <= s)
          cout << m + 1 << endl;
        else
          cout << "0\n";
      }
    }
  }
  return 0;
}
