#include #define ll long long #define mp make_pair #define fi first #define se second #define pb push_back #define vi vector #define pi pair #define mod 998244353 template bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;} template bool chkmax(T &a, T b){return (b > a) ? a = b, 1 : 0;} ll ksm(ll a, ll b) {if (b == 0) return 1; ll ns = ksm(a, b >> 1); ns = ns * ns % mod; if (b & 1) ns = ns * a % mod; return ns;} using namespace std; int n; ll m; const int maxn = 100005; int a[maxn]; ll s = 0; int main() { int t; cin >> t; while (t--) { cin >> n >> m; ll sum = 0; for (int i = 1; i <= n; i++) scanf("%d", &a[i]), sum += a[i]; ll x = 0; ll ans = -1; ll mx = 0; for (int j = 1; j <= 4; j++) { if (ans != -1) break; for (int i = 1; i <= n; i++) { x += a[i]; chkmax(mx, x); if (x >= m) { ans = j; break; } if (x < 0) x = 0; } } if (sum > 0 && ans == -1) ans = 4 + (m - mx + sum - 1) / sum; cout << ans << endl; } return 0; }