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