fun main(){
  val (N,M) = readInts()
  val A = readInts()

  var sm = 0
  for(l in A){
    sm += l
  }

  val ans = N-sm
  if (ans>-1){
    println(ans)
  }
  else println(-1)
}


fun readLn() = readLine()!! // string line
fun readInt() = readLn().toInt() // single int
fun readStrings() = readLn().split(" ") // list of strings
fun readInts() = readStrings().map { it.toInt() } // list of ints