Imports System.Collections
Imports System.Collections.Generic
Imports System.Linq
Imports System.xml
Imports System.xml.Linq

Module Module1
	public sub main()

		dim NM as string() = Console.ReadLine().split(" ")
		dim A as string() = Console.ReadLine().split(" ")

		dim day as Integer = convert.toint32(NM(0))
		dim homeworks as Integer = convert.toint32(NM(1))
		dim sumHomework as Integer = 0
		for each stra as string in A
			sumHomework += convert.toint32(stra)
		next
		
		select case true
			case sumHomework > day
				console.writeLine("-1")
			case else
				console.writeLine((day - sumHomework).tostring)
		end select
		
	  
	end sub 
End Module