#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 10;
long long t, n, k, b, ans, ans1;
vector<long long> sum;
vector<long long> v;
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> t;
  while (t) {
    ans = 0;
    ans1 = 0;
    v.clear();
    sum.clear();
    t--;
    cin >> n >> k;
    sum.push_back(0);
    v.push_back(0);
    for (long long a, i = 1; i <= n; i++) {
      cin >> a;
      v.push_back(a);
      sum.push_back(sum[i - 1] + v[i]);
    }
    sum.push_back(1e17);
    b = upper_bound(sum.begin(), sum.end(), k) - sum.begin() - 1;
    ans = max(ans, b);
    if (b == n) {
      cout << 0 << endl;
    } else {
      long long b1 = b;
      for (long long i = 0; i <= b1 + 1; i++) {
        b = upper_bound(sum.begin(), sum.end(), k + v[i]) - sum.begin() - 1;
        if (b > ans) {
          ans1 = i;
          ans = b;
        }
      }
      cout << ans1 << endl;
    }
  }
}
