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(N)

elif N < 0:

    print((-1))
#先にAの合計値を出してもよい

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

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

suma = sum(A)

if N-suma>=0:

    print((N-suma))

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(N)
elif N < 0:
    print((-1))

# 先にAの合計値を出してもよい
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
suma = sum(A)
if N - suma >= 0:
    print((N - suma))
else:
    print((-1))

+# 先にAの合計値を出してもよい -for i in range(M): -    N -= A[i] -if N >= 0: -    print(N) -elif N < 0: +suma = sum(A) +if N - suma >= 0: +    print((N - suma)) +else: