fun main(args: Array<String>) {
    val sLine = readLine()!!.split(" ").map(String::toInt)
    val n = sLine[0]
    val m = sLine[1]
    val aList = readLine()!!.split(" ").map(String::toInt).toMutableList()

    val hwDays = aList.sum()

    val result = if(n - hwDays >= 0) n - hwDays else -1

    println(result)
}