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 len(L) > len(B) or len(L) >= ans: return if now == N: temp = [] for a in L: temp.append(a) temp.sort(reverse=True) for i in range(len(temp)): if temp[i] > B[i]: return 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)