defmodule Main do
  def main do
    [n, k] = 
      IO.gets("")
      |> String.trim()
      |> String.split()
      |> Enum.map(&String.to_integer/1)
#    d = 
#      IO.gets("")
#      |> String.trim()
#      |> String.to_integer()
    a =  
      IO.stream(:stdio, :line) 
      |> Enum.take(2 * k) 
      |> Enum.map(&String.trim(&1)) 
      |> Enum.map(&String.split(&1)) 
      |> Enum.map(&Enum.map(&1, fn str -> String.to_integer(str) end))
	
    n - solve(a, [])
    |> IO.puts()

  end
  
  def solve([], acc), do: Enum.sort(acc) |> Enum.dedup() |> Enum.count()
  def solve([_ | [a | tail]], acc), do: solve(tail, acc ++ a)
end
    