fun main(args: Array<String>) {
    val arg1 = readLine()!!.split(" ")
    val holidayCounts = arg1[0].toInt()
    val homeworkCounts = arg1[1].toInt()
    val homeworkList = readLine()!!.split(" ").asSequence().map { it.toInt() }.toList()

    val homeworkDays = (0 until homeworkCounts).asSequence().map { homeworkList[it] }.sum()

    val enjoyTimes = holidayCounts - homeworkDays
    if (enjoyTimes >= 0)  println(enjoyTimes) else println("-1")
}