N = int(input()) A = list(map(int, input().split())) M = int(input()) B = list(map(int, input().split())) B.sort(reverse=True) inf = 10 ** 18 ans = inf def dfs(L = [], now = 0): global ans if now == N: if len(L) > len(B): return temp = [] for a in L: temp.append(a) temp.sort(reverse=True) flag = 1 for i in range(len(temp)): if temp[i] > B[i]: flag = 0 break if flag: ans = min(ans, len(temp)) return for i in range(len(L)): L[i] += A[now] dfs(L, now + 1) L[i] -= A[now] L.append(A[now]) dfs(L, now + 1) L.pop() return dfs() print(ans) if ans != inf else print(-1)