n, m = read_line.split.map(&.to_i) ord = Array.new(n, 0) m.times do a, b = read_line.split.map(&.to_i) ord[b - 1] += 1 end puts ord.count(0)