program main
  implicit none
  integer :: N,M
  integer,allocatable :: A(:)
  integer :: out
  read(*,*) N, M
  allocate(A(M))
  read(*,*) A(:)
  out = N-sum(A)
  if (out < 0) then
     write(*,'(i0)') -1
  else 
     write(*,'(i0)') out
  end if
end program main