n, m, *A = list(map(int, open(0).read().split()))

ans = n-sum(A)

print((ans if ans >= 0 else -1))
n, m, *A = list(map(int, open(0).read().split()))

print((max(n-sum(A), -1)))
n, m, *A = list(map(int, open(0).read().split()))
ans = n - sum(A)
print((ans if ans >= 0 else -1))

n, m, *A = list(map(int, open(0).read().split()))
print((max(n - sum(A), -1)))

-ans = n - sum(A) -print((ans if ans >= 0 else -1)) +print((max(n - sum(A), -1)))