fun main (args:Array<String>) {
    val (a , b) = readLine()!!.split(" ").map(String::toInt)
    var list :MutableList<Int> = arrayListOf()
    var goukei = 0
    readLine()!!.split(" ").map(String::toInt).forEach{
        goukei += it
    }
    if(goukei > a){
        print("-1")
        return
    }
    print(a - goukei)

}