protocol InitFromString {
    init?(_ str: String)
}
 
extension Int: InitFromString {}
extension Int8: InitFromString {}
extension Int16: InitFromString {}
extension Int32: InitFromString {}
extension Int64: InitFromString {}
extension String: InitFromString {}

func input<T: InitFromString>() -> [T] {
    readLine()!.split(separator: " ").map(String.init).compactMap(T.init)
}

func main(){
    let nm: [Int] = input()
    let n = nm[0]
    let _ = nm[1]
    let A: [Int] = input()
    let total: Int = A.reduce(0, +)

    let ans: Int
    if total > n {
        ans = -1
    } else {
        ans = n - total
    }

    print(ans)

}

main()