fun main(args: Array<String>) {
    result()
}

private fun result() {
    readLine()?.split(" ")?.let {
        var summerDay = it[0].toInt()
        val homeworkCount = it[1].toInt()
        val quote = readLine()?.split(" ")?.map { it.toInt() }?: emptyList()
        quote.forEach {
            summerDay -= it
        }
        if (summerDay < 0) {
            println("-1")
        } else {
            println(summerDay)
        }
    }
}