let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let n, m = Scanf.sscanf (read_line ()) "%d %d" @@ fun n m -> (n, m)
let a = read_line () |> split_string ~pattern:" " |> List.map int_of_string

let sum = List.fold_left (+) 0 a

let () = Printf.printf "%d\n" @@ if sum <= n then n - sum else -1