import Foundation

let num = readLine()!.components(separatedBy:" ").map{ Int($0)! }
let work = readLine()!.components(separatedBy:" ").map{ Int($0)! }.reduce(0) { $0 + $1 }
if( num[0] >= work){
  print(num[0] - work)
}else{
  print("-1")
}