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