#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) {
    long long n, ta;
    cin >> n >> ta;
    vector<long long> v(n);
    long long sum = 0, x = ta, y = ta;
    for (int i = 0; i < n; i++) {
      cin >> v[i];
      sum += v[i];
    }
    if (sum <= ta) {
      cout << 0 << "\n";
      continue;
    }
    long long ans = 0;
    for (int i = 1; i < n; i++) {
      if (v[i] < v[ans]) {
        if (ta >= v[i]) {
          ta -= v[i];
        } else {
          break;
        }
      } else {
        if (ta >= v[ans]) {
          ta -= v[ans];
          ans = i;
        } else {
          break;
        }
      }
    }
    long long cnt1 = 0;
    for (int i = 0; i < ans; i++) {
      cnt1 += v[i];
    }
    y -= cnt1;
    if (ans + 1 < n && v[ans + 1] > y) {
      cout << 0 << "\n";
    } else if (x < v[0] && n == 1)
      cout << 0 << "\n";
    else if (n >= 2 && x < v[0] && x < v[1]) {
      cout << 0 << "\n";
    } else {
      cout << ans + 1 << "\n";
    }
  }
}
