program main
  
  implicit none
  integer(8) :: n, m
  integer(8),allocatable :: a(:)
  
  read(*,*) n, m
  allocate( a(m) )
  read(*,*) a
  

  if ( sum(a) > n ) then
    print*, "-1" 
  else
    print*, n - sum( a ) 
  end if
   
end program main
