N,M=map(int,input().split())

X=[0]*(M+1)
for _ in range(N):
    A=list(map(int,input().split()))[1:]
    for a in A:
        X[a]+=1
print(X.count(N)) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M X=[0]*(M+1) X [0]*(M+1) [0] 0 M+1 M 1 for _ in range(N):
    A=list(map(int,input().split()))[1:]
    for a in A:
        X[a]+=1 _ range(N) range N A=list(map(int,input().split()))[1:] A list(map(int,input().split()))[1:] (map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split 1: 1 for a in A:
        X[a]+=1 a A X[a]+=1 X[a] X a 1 print(X.count(N)) print X.count(N) X.count X count N A=list(map(int,input().split()))[1:] list(map(int,input().split()))[1:] A N,M=map(int,input().split()) map(int,input().split()) N X=[0]*(M+1) [0]*(M+1) X M=map(int,input().split()) map(int,input().split()) M
N,M=map(int,input().split())

X=[0]*(M+1)
for _ in range(N):
    A=list(map(int,input().split()))[1:]
    for a in A:
        X[a]+=1
print(X.count(N))
