#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    vector<long long> vec;
    long long n, k;
    cin >> n >> k;
    long long mx = 0;
    long long sum = 0;
    int pos = 0;
    for (int i = 1; i <= n; i++) {
      long long rd;
      cin >> rd;
      vec.push_back(rd);
    }
    bool flg = 0;
    for (int i = 0; i < vec.size(); i++) {
      long long a;
      a = vec[i];
      if (a > mx) {
        mx = a;
        pos = i + 1;
      }
      sum += a;
      if (sum > k) {
        flg = 1;
        break;
      }
    }
    if (flg)
      cout << pos << endl;
    else
      cout << "0" << endl;
  }
}
