
fun main (args:Array<String>) {
    val (summerVacationDays, _ ) = readLine()!!.split(" ").map(String::toInt)
    val homeworkDay = readLine()!!.split(" ").map(String::toInt).sum()
    if(homeworkDay > summerVacationDays){
        print("-1")
        return
    }
    print(summerVacationDays - homeworkDay)

}
