fun main() {
    val input: List<Long> = readLine()!!.split(" ").map { it.toLong() }//条件入力
val homework: List<Long> = readLine()!!.split(" ").map { it.toLong() }//条件入力
var homework_sum=0L
for (i in homework){
    homework_sum+=i
}
val anwer=input[0]-homework_sum
when{
    anwer<0 ->{
        println("-1")
    }
    else ->{
        println(anwer)
    }
}
}