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

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

if sum(a)>n:

  print('-1')

else:

  print((n-sum(a)))

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

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

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

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

-if sum(a) > n: -    print("-1") -else: -    print((n - sum(a))) +print(("-1" if sum(a) > n else n - sum(a)))