n, m = list(map(int, input().split()))

A = list(map(int, input().split()))



if sum(A) <= n:

    print((n - sum(A)))

else:

    print((-1))
N, M = list(map(int, input().split()))

A = list(map(int, input().split()))



if N - sum(A) >= 0:

    print((N - sum(A)))

else:

    print((-1))
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
if sum(A) <= n:
    print((n - sum(A)))
else:
    print((-1))

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

-n, m = list(map(int, input().split())) +N, M = list(map(int, input().split())) -if sum(A) <= n: -    print((n - sum(A))) +if N - sum(A) >= 0: +    print((N - sum(A)))