import itertools import copy N = int(input()) lsA = list(map(int,input().split())) M = int(input()) lsB = list(map(int,input().split())) lsB.sort(reverse=True) lsp = itertools.permutations(lsA) cnt = float('INF') for p in lsp: lsB1 = copy.copy(lsB) for i in range(N): f = False for j in range(M): if lsB1[j] >= p[i]: lsB1[j] -= p[i] f = True break if f == False: break if f: ii = 0 for j in range(M): if lsB1[j] != lsB[j]: ii += 1 cnt = min(ii,cnt) if cnt == float('INF'): print(-1) else: print(cnt)