#include #define RAN(v) v.begin(), v.end() #define pb push_back #define lb lower_bound #define ub upper_bound using namespace std; typedef long long ll; template inline void upd1(T1& a, const T2& b) { a = a < b ? a : b; } template inline void upd2(T1& a, const T2& b) { a = b < a ? a : b; } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } struct Ano { operator ll() { ll x = 0, y = 0, c = getchar(); while (c < 48) { y = c == 45; c = getchar(); } while (c > 47) { x = x*10 + c-48; c = getchar(); } return y ? -x : x; } } buf; constexpr int N = 1e5 + 5; int a[N]; int main() { int t = buf; while (t--) { int n = buf; ll m = buf; for (int i = 0; i < n; ++i) { a[i] = buf; } auto cal = [=] (ll x) -> array { ll s = 0; for (int i = 0; i < n; ++i) { x = max(x + a[i], 0ll); upd2(s, x); } return {x, s}; }; auto x = cal(0); if (x[1] >= m) { puts("1"); } else { auto y = cal(x[0]); if (y[1] >= m) { puts("2"); } else if (x[0] == y[0]) { puts("-1"); } else { printf("%lld\n", (m - y[1] - 1) / (y[0] - x[0]) + 3); } } } }