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

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



for i in range(m):

    n -= a[i]



if n < 0:

    print((-1))

else:

    print(n)

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

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



if n >= sum(a):

    print((n-sum(a)))

else:

    print((-1))

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(m):
    n -= a[i]
if n < 0:
    print((-1))
else:
    print(n)

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

-for i in range(m): -    n -= a[i] -if n < 0: +if n >= sum(a): +    print((n - sum(a))) +else: -else: -    print(n)