N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
 
if (N < M):
	print("-1")
else:
	sum = 0
    for i in range(M):
    	sum = sum + A[i]
    if(sum <= N):
    	sub = N-sum
        print(sub)
   	else:
    	print("-1")