#region Header #!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools import bisect import heapq def input(): return sys.stdin.readline()[:-1] # sys.setrecursionlimit(1000000) #endregion # _INPUT = """2 # 8 12 # 2 # 10 10 # """ # sys.stdin = io.StringIO(_INPUT) def main(): N = int(input()) A = list(map(int, input().split())) M = int(input()) B = list(map(int, input().split())) B.sort(reverse=True) ans = 100 for pat in itertools.permutations(A): i = 0 cap = B[0] ok = True for item in pat: if item <= cap: cap -= item else: i += 1 if i == M-1 or B[i] < item: ok = False break cap = B[i] - item if ok: ans = min(ans, i+1) if ans == 100: print(-1) else: print(ans) if __name__ == '__main__': main()