import java.util.Scanner


object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n, m = sc.nextInt()

    val as = List.fill(m)(sc.nextInt)

    val ans = if (n < as.sum) -1 else n - as.sum

    println(ans)

  }
}