import Enum

defmodule Main do
  def main do
    n = IO.read(:line) |> String.trim |> String.split(" ") |> Enum.at(0) |> String.to_integer()
    s = IO.read(:line) |> String.trim |> String.split(" ") |> Enum.map(fn x -> String.to_integer(x) end) |> Enum.sum();
    #IO.puts(n - IO.read(:line) |> String.trim |> String.split(" ") |> Enum.map(fn x -> String.to_integer(x) end) |> Enum.sum())
    if (n < s) do
      IO.puts(-1)
    else
      IO.puts(n-s)
    end
  end
end
