program main
      implicit none
      integer(4) :: n, m, i
      integer(4), allocatable :: a(:)
      integer(8) :: cnt

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

      cnt = 0
      do i = 1, m
        cnt = cnt + a(i)
      end do
      if ( cnt > n ) then
              print *, -1
      else
              print *, n - cnt
      end if

end program main
