from itertools import permutations N = int(input()) A = list(map(int,input().split())) M = int(input()) B = list(map(int,input().split())) B.sort(reverse = True) ans = M + 1 for P in permutations(A,N): j = 0 now = B[0] f = True for i in range(N): if now >= P[i]: now -= P[i] else: j += 1 if j < M: now = B[j] if now >= P[i]: now -= P[i] else: f = False break else: f = False break if f: ans = min(ans,j + 1) if ans == M + 1: print(-1) else: print(ans)