defmodule Main do
  def main do
    r =
      IO.read(:line)
      |> String.trim
      |> String.to_integer
    g =
      IO.read(:line)
      |> String.trim
      |> String.to_integer
    IO.puts(2 * g - r)
  end
end
