import java.io.*; import java.util.ArrayList; import java.util.StringTokenizer; public class Main { private static ArrayList list = new ArrayList<>(); public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++){ int n = sc.nextInt(); long m = sc.nextLong(); long [] data = new long[n]; for (int j = 0; j < n; j++){ data[j] = sc.nextLong(); } long num = 0; long answer = -1; boolean flag = false; //first walk for (int j = 0; j < n; j++){ num+=data[j]; if (num >= m){ answer = 1; flag = true; break; } if (num < 0){ num = 0; } } long firstWalk = num; //second walk long maximumReach = num; if (!flag){ for (int j = 0; j < n; j++){ num+=data[j]; if (num >= m){ answer = 2; flag = true; break; } if (num < 0){ num = 0; } maximumReach = Math.max(num,maximumReach); } } if (!flag){ if (num > firstWalk){ long addition = num - firstWalk; maximumReach -= num; answer = (m - firstWalk - maximumReach)/addition; answer++; if ((m - firstWalk - maximumReach)%addition > 0 ){ answer++; } } } list.add(answer); } for (int i = 0; i < list.size(); i++){ System.out.println(list.get(i)); } } static public class Scanner { StringTokenizer st; BufferedReader br; public Scanner(InputStream s) { br = new BufferedReader(new InputStreamReader(s)); } public String next() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine()); return st.nextToken(); } public Scanner(String s) throws FileNotFoundException { br = new BufferedReader(new FileReader(s)); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } } }