fun main(args: Array<String>) {
  val input1 = readLine()!!.split(" ").map(String::toInt)
  val days = input1[0]
  val count = input1[1]
  var homeWorkDays = 0
  val work = readLine()!!.split(" ").map(String::toInt)
  homeWorkDays = work.sum()
  val result = if (days < homeWorkDays) -1 else days - homeWorkDays
  println(result)
}
