#include using namespace std; typedef long long ll; template ostream &operator<<(ostream &io, vector a) { io << "{"; for (auto I:a)io << I << " "; io << "}"; return io; } template ostream &operator<<(ostream &io, set a) { io << "{"; for (auto I:a)io << I << " "; io << "}"; return io; } template ostream &operator<<(ostream &io, map a) { io << "("; for (auto I:a)io << "{" << I.first << ":" << I.second << "}"; io << ")"; return io; } void debug_out() { cerr << endl; } template void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); } #ifdef local #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) #else #define debug(...) 55 #endif #define all(x) x.begin(),x.end() mt19937_64 Rand(123456); ll Range(ll l, ll r) { return l + Rand() % (r - l + 1); } const int mod = 998244353; ll power(ll a, ll b) { ll res = 1; while (b) { if (b & 1)res = res * a % mod; a = a * a % mod; b >>= 1; } return res; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); #ifdef local freopen("../in.txt", "r", stdin); #endif int _; cin >> _; while (_--) { ll n,m;cin>>n>>m; vector a(n+1); for(int i =1;i<=n;i++)cin>>a[i]; ll x = 0; bool ok = 0; for(int i =1;i<=n;i++){ x+=a[i]; x=max(x,0ll); if(x>=m){ ok = 1; } } if(ok){ cout<<1<<"\n";continue; } ll now = x; ok = 0; bool never = 0; ll mx = 0; for(int i =1;i<=n;i++){ x+=a[i]; if(x<=0){ never = 1; } x=max(x,0ll); if(x>=m){ ok = 1; } mx = max(x,mx); } if(ok){ cout<<2<<"\n";continue; } if(never){ cout<<-1<<"\n";continue; } debug(x,now,m); cout<<2+(m-mx-1)/(x-now)+1<<'\n'; } }