fun main() {
    val (N, M) = readLine()!!.split(" ").map(String::toInt)
    val AM = readLine()!!.split(" ").map(String::toInt)
    val sum = AM.sum()
    if (N < sum) {
        println("-1")
    } else {
        println(N - sum)
    }
}



