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

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

b = 0

for i in range(m):

  b +=a[i]

if n<b:

  print("-1")

else:

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

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

b = sum(a)

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

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = sum(a)
print((max(-1, n - b)))

-b = 0 -for i in range(m): -    b += a[i] -if n < b: -    print("-1") -else: -    print((n - b)) +b = sum(a) +print((max(-1, n - b)))