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