#include using namespace std; typedef long long s64; const int D=998244353; s64 pow_mod(s64 x,int y){ s64 ans=1; while(y){ if(y&1)ans=ans*x%D; x=x*x%D;y>>=1; } return ans; } const int N=1e5+5; int a[N]; s64 sum[N],mx[N],mn[N]; int main(){ #ifdef kcz freopen("1.in","r",stdin);//freopen("1.out","w",stdout); #endif int tt; cin>>tt; while(tt--){ int n;s64 m; cin>>n>>m; for(int i=1;i<=n;++i){ scanf("%d",a+i); sum[i]=sum[i-1]+a[i]; mn[i]=min(mn[i-1],sum[i]); mx[i]=max(mx[i-1],sum[i]); } s64 x=0; for(int i=1;i<=n;++i){ x=max(0LL,x+a[i]); if(x>=m)break; } if(x>=m){ puts("1"); continue; } for(int i=1;i<=n;++i){ x=max(0LL,x+a[i]); if(x>=m)break; } if(x>=m){ puts("2"); continue; } if(sum[n]<=0){ puts("-1"); continue; } //x+(k-3)*sum[n]+mx[n] cout<<(m-mx[n]-x+sum[n]*4-1)/sum[n]<