object Main extends App{
  import scala.io.StdIn.readLine
  var NM = readLine
  var A = readLine
  var N = NM.split(" ")(0).toInt
  var M = NM.split(" ")(1).toInt
  var sum = 0;
  for(i <- 0 until M){
  sum += A.split(" ")(i).toInt
  }
   if(sum > N){
  println(-1)
  }
  else{
    var num = N-sum
  println(num)
  }

  
}