// Arup Guha
// 2/23/2019
// Illustration of Memoization for Fewest Coins Problem.

import java.util.*;

public class fewestcoins {
	
	final public static int NO_SOLUTION = -1;
	final public static int NOT_SOLVED = -2;
	
	public static int[] memo;
	
	public static void main(String[] args) {
		
		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();
		
		// Go through cases.
		for (int loop=0; loop<numCases; loop++) {
			
			// Get all denominations.
			int n = stdin.nextInt();
			int[] denom = new int[n];
			for (int i=0; i<n; i++)
				denom[i] = stdin.nextInt();
		
			// Get how much we are trying to make change for.
			int change = stdin.nextInt();
			
			// Set up memo.
			memo = new int[change+1];
			Arrays.fill(memo, NOT_SOLVED);
			
			// Go! (-1 means no solution)
			System.out.println(go(change, denom));
		}
	}
	
	// Returns fewest number of coins necessary to make change for change cents.
	public static int go(int change, int[] denom) {
		
		// Can't do it.
		if (change < 0) return NO_SOLUTION;
		
		// No coins needed for 0 cents.
		if (change == 0) return 0;
		
		// We have an answer for this already.
		if (memo[change] != NOT_SOLVED) return memo[change];
		
		int res = NO_SOLUTION;
		
		// Try giving each possible coin.
		for (int i=0; i<denom.length; i++) {
			
			// This won't work.
			if (denom[i] > change) continue;
			
			// Answer for giving this coin.
			int cur = go(change-denom[i], denom);
			
			// Assign # of coins for this branch.
			int tmp = cur != NO_SOLUTION ? cur+1 : NO_SOLUTION;
			
			// When to update our result.
			if (res == NO_SOLUTION && tmp != NO_SOLUTION) res = tmp;
			else if (tmp != NO_SOLUTION && tmp < res) res = tmp;
		}
		
		// Store and return.
		return memo[change] = res;
	}

}
