import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = Integer.parseInt(sc.nextLine());
int[] priceNum = new int[num];
for(int i = 0;i<num;i++){
priceNum[i] = Integer.parseInt(sc.nextLine());
}
Arrays.sort(priceNum);
int sumMoney = Integer.parseInt(sc.nextLine());
int result = 0;
for(int i = priceNum.length - 1;i>=0;i--){
if(priceNum[i] == 0){
continue;
}
result += sumMoney / priceNum[i];
sumMoney = sumMoney % priceNum[i];
if(sumMoney == 0){
break;
}
}
if(result == 0){
System.out.println(-1);
}else if(sumMoney != 0){
System.out.println(-1);
}
else{
System.out.println(result);
}
}
}
#笔试题目##秋招##小米#