n, m = map(int, input().split()) G = [True for i in range(n)] for i in range(m): a, b = map(int, input().split()) G[b - 1] = False print(sum(G))