fun main() {
    val n = readLine()!!.split(" ").map(String::toInt)[0]
    val al = readLine()!!.split(" ").map(String::toInt)
    var sum = 0
    for (x in al) {
        sum += x
    }
    val p = n - sum
    if (p < 0) {
        println(-1)
    }
    else {
        println("${p}")
    }
}