N, M = map(int,input().split())
a = []
ans = range(1,M + 1)
ans = list(ans)
for i in range(N):
    A = list(map(int,input().split()))
    K = A[0]
    A.remove(A[0])
    for j in range(1,M + 1):
        if j not in A:
            a.append(j)
for i in a:
    if i in ans:
        ans.remove(i)
print(len(ans)) N, M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M a = [] a [] ans = range(1,M + 1) ans range(1,M + 1) range 1 M + 1 M 1 ans = list(ans) ans list(ans) list ans for i in range(N):
    A = list(map(int,input().split()))
    K = A[0]
    A.remove(A[0])
    for j in range(1,M + 1):
        if j not in A:
            a.append(j) i range(N) range N A = list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split K = A[0] K A[0] A 0 A.remove(A[0]) A.remove A remove A[0] A 0 for j in range(1,M + 1):
        if j not in A:
            a.append(j) j range(1,M + 1) range 1 M + 1 M 1 if j not in A:
            a.append(j) j not in A j A a.append(j) a.append a append j for i in a:
    if i in ans:
        ans.remove(i) i a if i in ans:
        ans.remove(i) i in ans i ans ans.remove(i) ans.remove ans remove i print(len(ans)) print len(ans) len ans ans = list(ans) list(ans) ans A = list(map(int,input().split())) list(map(int,input().split())) A M = map(int,input().split()) map(int,input().split()) M K = A[0] A[0] K ans = range(1,M + 1) range(1,M + 1) ans N, M = map(int,input().split()) map(int,input().split()) N a = [] [] a
N, M = map(int,input().split())
a = []
ans = range(1,M + 1)
ans = list(ans)
for i in range(N):
    A = list(map(int,input().split()))
    K = A[0]
    A.remove(A[0])
    for j in range(1,M + 1):
        if j not in A:
            a.append(j)
for i in a:
    if i in ans:
        ans.remove(i)
print(len(ans))