import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
N, M = map(int, input().split())
S = sum(list(map(int, input().split())))
print(-1 if S > N else N - S)

b07a2a9537c51035996bd0e3b0f603ab781518d8
<mask token>

<mask token>
print(-1 if S > N else N - S)

<mask token>
N, M = map(int, input().split())
S = sum(list(map(int, input().split())))
print(-1 if S > N else N - S)

import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy
N, M = map(int, input().split())
S = sum(list(map(int, input().split())))
print(-1 if S > N else N - S)
