object Main extends App {
  val List(n,m) = io.StdIn.readLine.split(" ").toList.map(_.toInt)
  val a_sum = io.StdIn.readLine.split(" ").toList.map(_.toInt).sum
  
  val t = n - a_sum
  if(t<0){
    println(-1)
  }else{
    println(t)
  }
}