#include <bits/stdc++.h>
using namespace std;
const int MAX = 800;
const int maxn = 2e5 + 100;
int n, second, t, a[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> t;
  while (t--) {
    cin >> n >> second;
    long long sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
    }
    if (sum <= second) {
      cout << "0\n";
      continue;
    }
    int ans = 0;
    sum = a[0];
    int j = 1;
    int great = a[0], idx = 0;
    for (; j < n; j++) {
      if (a[j] > great) {
        great = a[j], idx = j;
      }
      if (sum + a[j] <= second) {
        sum += a[j];
      } else {
        break;
      }
    }
    ans = j;
    sum -= great;
    for (; j < n; j++) {
      if (sum + a[j] <= second) {
        sum += a[j];
      } else {
        break;
      }
    }
    if (j > ans) {
      cout << idx + 1 << '\n';
    } else {
      cout << "0\n";
    }
  }
  return 0;
}
