import java.io.PrintWriter
import kotlin.math.max

//private val inp = java.io.File("in")
private val inp = System.`in`
private val reader = inp.bufferedReader()
private val wr = PrintWriter(System.out.bufferedWriter())

private fun readLn(): String = reader.readLine()
private fun readInt(): Int = readLn().toInt()
private fun readStrs(): List<String> = readLn().split(" ")
private fun readInts(): IntArray = readStrs().map { it.toInt() }.toIntArray()
private fun readChars(): CharArray = readStrs().map { it.single() }.toCharArray()
private fun readLongs(): LongArray = readLn().map { it.toLong() }.toLongArray()

fun main() {
//    val (n, m) = readInts()
//    val a = readInts()
//
//    var sum = 0L;
//    for (i in a) sum += i
//    val r = n - sum
//
//    println(if (r < 0) -1 else r)

    val (n, m) = readInts()
    val a = readLongs()

//    println(max(n - a.sum(), -1))
    println((n - a.sum()).takeIf { it >= 0 } ?: -1)
//    println((n - a.sum()).takeIf { it >= 0 } ?: -1)
}