#include #define db double #define reg register #define LL long long #define pb push_back #define lb lower_bound #define ub upper_bound #define ull unsigned long long #define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;++i) #define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;--i) #define erep(i,a) for(int i=head[a];i;i=e[i].nxt) using namespace std; bool Handsome; inline LL rd(){ reg LL x=0;reg char o=getchar();reg bool O=0; for(;o<48 || 57y && (x=y));} inline void Mx(LL &x,LL y){if(x=m)return puts("1"),void(); } LL c=t;mi[p]=0; rep(i,1,p){ if(c+mx[i]>=m)return puts("2"),void(); c+=mi[i]; if(c<=0)return puts("-1"),void(); } LL s=m;c=0; rep(i,1,p){ Mi(s,m-mx[i]-c); c+=mi[i]; } LL d=t+tot; LL ans=(s-t-1)/d+3; printf("%lld\n",ans); } bool Most; int main(){ // printf("%.2lfMB\n",(&Most-&Handsome)/1024.0/1024.0); int t=rd(); while(t--)Clear(),solve(); return 0; }