program problemB
  implicit none

real(8) ::   d, e
integer(8) :: n,m, yr, l, i, k, j,judge, small, kref, r, b, t, f
integer(8) :: BNUM, RNUM, NMAX, count,MMAX, sum
character(len=4) :: color
integer, allocatable :: A(:)


read(*,*) NMAX,MMAX

allocate(A(MMAX))
read(*,*) A
sum=sum(A)
deallocate(A)

if (A>NMAX) then
  write(*,*) -1
else
  write(*,*) NMAX-A
end if


stop
end program
