#include #define LL long long #define dl double #define Pi pair #define SZ(a) ((int)a.size()) using namespace std; const int N = 1e5 + 10; int T,n; LL m; int a[N]; LL s[5][N]; LL work(){ LL now = 0; for(int o = 1;o <= 4;o++){ for(int i = 1;i <= n;i++){ now += a[i]; if(now < 0)now = 0; s[o][i] = now; if(now >= m)return o; } } bool flg = 0; for(int i = 1;i <= n;i++)if(s[4][i] > s[3][i])flg = 1; if(!flg)return -1; LL mn = 1e18; for(int i = 1;i <= n;i++){ mn = min(mn,(m - s[4][i] + s[4][i] - s[3][i] - 1) / (s[4][i] - s[3][i])); } return mn + 4; } int main(){ // freopen("in.txt","r",stdin); // freopen("o.txt","w",stdout); std::ios::sync_with_stdio(false); std::cin.tie(nullptr); cin >> T; while(T--){ cin >> n >> m; for(int i = 1;i <= n;i++)cin >> a[i]; cout << work() << endl; } return 0; } /**/