#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, m;
  for (cin >> t; t--;) {
    cin >> n >> m;
    int ans, s = 0;
    for (int i = 1, max = 0, j; i <= n; i++) {
      cin >> j;
      if (s <= m) {
        if (j > max) {
          max = j;
          ans = i;
        }
        s += j;
      }
    }
    if (s <= m) {
      cout << 0 << endl;
    } else {
      cout << ans << endl;
    }
  }
}
