object Main extends App {
  val Array(n, m) = io.StdIn.readLine().split(' ').map(_.toInt)
  val am = io.StdIn.readLine().split(' ').map(_.toInt)
  val x = n - am.sum
  println(if (x >= 0) x else -1)
}