      PROGRAM piyo
      IMPLICIT NONE
      integer(16) :: n,m,ans
      integer(16) :: a(10**4)
      
      read*,n,m
      read*,a(1:m)
      
      ans = n - sum( a(1:m) )
      
      if( ans>=0 )then
        print*,ans
      else
        print*,'-1'
      end if
      
      
      
      
      
      
      END PROGRAM