let n, m = Scanf.scanf "%d %d\n" @@ fun a b -> a, b
let a = Array.init m @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d
let ans =
  let x = n - (Array.fold_left (+) 0 a) in
  if x >= 0 then x else -1
let () = print_int ans