n,m = map(int, input().split())
l = [i for i in range(1,m+1)]
l2 = []
for _ in range(n):
    k = list(map(int, input().split()))
    del k[0]
    for i in range(len(l)):
        if l[i] not in k:
            l2.append(l[i])
l2 = list(set(l2))
print(len(l)-len(l2)) n,m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m i for i in range(1,m+1) for i in range(1,m+1) i range(1,m+1) range 1 m+1 m 1 for i in range(1,m+1) i l = [i for i in range(1,m+1)] l [i for i in range(1,m+1)] l2 = [] l2 [] for _ in range(n):
    k = list(map(int, input().split()))
    del k[0]
    for i in range(len(l)):
        if l[i] not in k:
            l2.append(l[i]) _ range(n) range n k = list(map(int, input().split())) k list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split del k[0] k[0] k 0 for i in range(len(l)):
        if l[i] not in k:
            l2.append(l[i]) i range(len(l)) range len(l) len l if l[i] not in k:
            l2.append(l[i]) l[i] not in k l[i] l i k l2.append(l[i]) l2.append l2 append l[i] l i l2 = list(set(l2)) l2 list(set(l2)) list set(l2) set l2 print(len(l)-len(l2)) print len(l)-len(l2) len(l) len l len(l2) len l2 l2 = list(set(l2)) list(set(l2)) l2 l = [i for i in range(1,m+1)] [i for i in range(1,m+1)] l l2 = [] [] l2 m = map(int, input().split()) map(int, input().split()) m k = list(map(int, input().split())) list(map(int, input().split())) k n,m = map(int, input().split()) map(int, input().split()) n
n,m = map(int, input().split())
l = [i for i in range(1,m+1)]
l2 = []
for _ in range(n):
    k = list(map(int, input().split()))
    del k[0]
    for i in range(len(l)):
        if l[i] not in k:
            l2.append(l[i])
l2 = list(set(l2))
print(len(l)-len(l2))