N = int(input()) A = list(map(int, input().split())) M = int(input()) B = list(map(int, input().split())) B.sort(reverse=True) score = [0]*(1<>i)&1: score[S] += A[i] dp = [[False]*(1<=score[S-T] T = (T-1)&S if T==S: break if dp[i+1][-1]: print(i+1) break else: print(-1)