program sample
implicit none
integer(8) N,M,A(10000),count,S,i
read(*,*) N,M
read(*,*) (A(i),i=1,M)
S=0
do i=1,M
S=A(i)+S
end do
count=N-S
if(count>=0) then
   write(*,*) count
else
   write(*,*) -1
end if

stop
end program sample