n, m = map(int, input().split()) d = [0] * n for i in range(m): a, b = map(int, input().split()) d[b - 1] += 1 print(d.count(0))