program main
  implicit none

  integer ::n, m, i, s
  integer, allocatable :: a(:)

  read *, n, m
  allocate(a(m))
  read *, a

  s = 0
  do i = 1, m
     s = s + a(i)
  end do

  if (s <= n) then
     print *, n-s
  else
     print *, '-1'
  end if
  
  stop
end program main
