N,M=map(int,input().split())
KA=[0]*N
count=[0]*(M+1)
for i in range(N):
  KA[i]=list(map(int,input().split()))
for i in range(N):
  for j in range(1,len(KA[i])):
    count[KA[i][j]]+=1
ans=0
for i in range(1,M+1):
  if count[i]==N :
    ans+=1
print(ans) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M KA=[0]*N KA [0]*N [0] 0 N count=[0]*(M+1) count [0]*(M+1) [0] 0 M+1 M 1 for i in range(N):
  KA[i]=list(map(int,input().split())) i range(N) range N KA[i]=list(map(int,input().split())) KA[i] KA i list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for i in range(N):
  for j in range(1,len(KA[i])):
    count[KA[i][j]]+=1 i range(N) range N for j in range(1,len(KA[i])):
    count[KA[i][j]]+=1 j range(1,len(KA[i])) range 1 len(KA[i]) len KA[i] KA i count[KA[i][j]]+=1 count[KA[i][j]] count KA[i][j] [i] KA i j 1 ans=0 ans 0 for i in range(1,M+1):
  if count[i]==N :
    ans+=1 i range(1,M+1) range 1 M+1 M 1 if count[i]==N :
    ans+=1 count[i]==N count[i] count i N ans+=1 ans 1 print(ans) print ans KA=[0]*N [0]*N KA ans+=1 1 ans count=[0]*(M+1) [0]*(M+1) count N,M=map(int,input().split()) map(int,input().split()) N ans=0 0 ans M=map(int,input().split()) map(int,input().split()) M
N,M=map(int,input().split())
KA=[0]*N
count=[0]*(M+1)
for i in range(N):
  KA[i]=list(map(int,input().split()))
for i in range(N):
  for j in range(1,len(KA[i])):
    count[KA[i][j]]+=1
ans=0
for i in range(1,M+1):
  if count[i]==N :
    ans+=1
print(ans)