N, M = map(int, input().split())
A = list(map(int, input().split()))
daystofinish = sum(A)
print(N-daystofinish)
N, M = map(int, input().split())
A = list(map(int, input().split()))
daystofinish = sum(A)
if N-daystofinish < 0:
    print(-1)
else:
    print(N-daystofinish)