#include #include #include #include #include #include #include #include using namespace std; int main() { int t; cin >> t; while (t--) { long long n, m; cin >> n >> m; vector a(n); int f = 0; for (int i = 0; i < n; i++) scanf("%lld", &a[i]); long long s = 0; for (int i = 0; i < n; i++) { s += a[i]; if (s >= m) { cout << "1\n"; f = 1; break; } if (s < 0) s = 0; } if (f == 1) continue; long long s2 = s; for (int i = 0; i < n; i++) { s2 += a[i]; if (s2 >= m) { cout << "2\n"; f = 1; break; } if (s2 < 0) s2 = 0; } if (f == 0) { if (s2 <= s) { cout << "-1\n"; } else { long long mx = -1; long long tmp = 0; for (int i = 0; i < n; i++) { tmp += a[i]; mx = max(mx, tmp); } cout << (m - mx - s - 1) / (s2 - s) + 3 << endl; } } } return 0; }