#include using namespace std; typedef long long ll; const int N = 2e5 + 10; ll a[N]; ll st[N]; int main() { int t; cin >> t; while(t--) { ll n, m; scanf("%lld%lld", &n, &m); for (int i = 1; i <= n; i++) scanf("%lld", &a[i]); ll s = 0, pos = -1,maxv = 0,sum2 = 0; bool f = 1; for (int i = 1; i <= n; i++) { sum2 += a[i]; maxv = max(maxv, sum2); s += a[i]; if (s >= m) { f = 0; break; } if (s < 0) { st[i] = s; s = 0; } } if(!f) { cout << 1 << '\n'; continue; } if (s <= 0) { cout << -1 << '\n'; continue; } ll sum1 = s; for (int i = 1; i <= n; i++) { sum1 += a[i]; if (sum1 >= m) { f = 0; break; } if (sum1 < 0) { st[i] = sum1; sum1 = 0; } } if (sum1 == s) { cout << -1 << '\n'; continue; } if(!f) { cout << 2 << '\n'; continue; } m -= s; m -= maxv; ll t = sum1 - s; cout << 2 + (m + t - 1) / t << '\n'; } return 0; }