

fun main() {
    val (n,m) = readLine()!!.split(" ").map { it.toInt() }
    val arr = readLine()!!.split(" ").map { it.toInt() }
    val diff = n - arr.sum()
    if(diff < 0)
        print(-1)
    else
        print(diff)


}