#include using namespace std; long long a[100010]; int main() { int T; scanf("%d", &T); int Case = 0; while (T--) { Case++; int n; long long m; scanf("%d%lld", &n, &m); long long sum = 0, minj = 0; for (int i = 1; i <= n; i++) { scanf("%lld", &a[i]); } long long maxj = 0, x; for (int i = 1; i <= n; i++) { sum += a[i]; minj = min(minj, sum); maxj = max(maxj, sum); if (sum - minj >= m) { printf("1\n"); goto END; } } x = sum - minj; if (x + minj <= 0 || sum <= 0) { for (int i = 1; i <= n; i++) { x += a[i]; if (x < 0) x = 0; if (x >= m) { printf("2\n"); goto END; } } printf("-1\n"); goto END; } else { long long lim = m - maxj; printf("%lld\n", max(0ll, (lim - x + sum - 1) / sum) + 1 + 1); } END:; } return 0; }