fun main(args: Array<String>) {
    val line = readLine()!!.trim()
    val (n, m) = line.split(" ").map {it.toLong()}

    val line2 = readLine()!!.trim()
    val ary: List<Long> = line2.split(" ").map {it.toLong()}.take(m.toInt())

    val remain = n - ary.sum()
    val answer = if (remain < 0) {
        -1L
    } else {
        remain
    }

    println("${answer}")
}