#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t > 0) {
    long long int n, s;
    cin >> n >> s;
    long long int a[n];
    long long int sum = 0;
    for (long long int i = (0); i < (n); i++) {
      cin >> a[i];
      sum = sum + a[i];
    }
    if (s >= sum) {
      cout << 0 << endl;
      t--;
      continue;
    }
    long long int flag = 0;
    long long int index;
    long long int count = 0;
    for (long long int i = (0); i < (n); i++) {
      count = count + a[i];
      if (count > s) {
        index = i;
        flag = 1;
        break;
      }
    }
    long long int m = INT_MIN;
    long long int ans = 0;
    for (long long int i = (0); i < (index + 1); i++) {
      if (a[i] > m) {
        m = a[i];
        ans = i;
      }
    }
    if (ans == index) {
      if (count - a[index] + a[index + 1] <= s) {
        cout << index + 1 << endl;
      } else {
        cout << 0 << endl;
      }
      t--;
      continue;
    } else {
      cout << ans + 1 << endl;
      t--;
      continue;
    }
  }
}
