N,M = map(int,input().split())
A=[]
for i in range(0,N,1):
    a = list(map(int,input().split()))
    A.append(a[1::])

ans = [i for i in range(1,M+1,1)]
for i in range(0,N,1):
    ans = list(set(ans) & set(A[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 [] for i in range(0,N,1):
    a = list(map(int,input().split()))
    A.append(a[1::]) i range(0,N,1) range 0 N 1 a = list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split A.append(a[1::]) A.append A append a[1::] a 1:: 1 i for i in range(1,M+1,1) for i in range(1,M+1,1) i range(1,M+1,1) range 1 M+1 M 1 1 for i in range(1,M+1,1) i ans = [i for i in range(1,M+1,1)] ans [i for i in range(1,M+1,1)] for i in range(0,N,1):
    ans = list(set(ans) & set(A[i])) i range(0,N,1) range 0 N 1 ans = list(set(ans) & set(A[i])) ans list(set(ans) & set(A[i])) list set(ans) & set(A[i]) set(ans) set ans set(A[i]) set A[i] A i print(len(ans)) print len(ans) len ans M = map(int,input().split()) map(int,input().split()) M a = list(map(int,input().split())) list(map(int,input().split())) a N,M = map(int,input().split()) map(int,input().split()) N A=[] [] A ans = list(set(ans) & set(A[i])) list(set(ans) & set(A[i])) ans ans = [i for i in range(1,M+1,1)] [i for i in range(1,M+1,1)] ans
N,M = map(int,input().split())
A=[]
for i in range(0,N,1):
    a = list(map(int,input().split()))
    A.append(a[1::])

ans = [i for i in range(1,M+1,1)]
for i in range(0,N,1):
    ans = list(set(ans) & set(A[i]))
print(len(ans))
