import scala.io.StdIn._

object Main extends App {

  val Array(n, m) = readLine().split(" ").map(_.toInt)
  val as = readLine().split(" ").map(_.toInt)

  if (n - as.sum < 0) {
    println(-1)
  } else {
    println(n - as.sum)
  }
}
