N, M = gets.split.map(&:to_i) s = Hash.new M.times do a, b = gets.split.map(&:to_i) s[b] = true end puts N - s.keys.size