#include <bits/stdc++.h>
using namespace std;
const int sz = 69999;
void flash() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.setf(ios::showpoint);
}
void Time() {}
int32_t main() {
  flash();
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, sum;
    cin >> n >> sum;
    long long int a[n];
    pair<long long int, long long int> mx = {-1, -1};
    for (long long int i = 0; i < n; i++) {
      cin >> a[i];
    }
    int flag = 0;
    for (long long int i = 0; i < n; i++) {
      sum -= a[i];
      mx = max(mx, make_pair(a[i], i));
      if (sum < 0) {
        flag = 1;
        cout << mx.second + 1;
        break;
      }
    }
    if (flag == 0) cout << 0;
    cout << "\n";
  }
  return 0;
}
