n,m=map(int,input().split())
x=[0]*m
for i in range(0,n):
  lis=list(map(int,input().split()))
  k=lis[0]
  for j in range(1,k+1):
    a=lis[j]-1
    x[a]+=1

ans=0
for y in x:
  if y==n:
    ans+=1
print(ans) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m x=[0]*m x [0]*m [0] 0 m for i in range(0,n):
  lis=list(map(int,input().split()))
  k=lis[0]
  for j in range(1,k+1):
    a=lis[j]-1
    x[a]+=1 i range(0,n) range 0 n lis=list(map(int,input().split())) lis list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split k=lis[0] k lis[0] lis 0 for j in range(1,k+1):
    a=lis[j]-1
    x[a]+=1 j range(1,k+1) range 1 k+1 k 1 a=lis[j]-1 a lis[j]-1 lis[j] lis j 1 x[a]+=1 x[a] x a 1 ans=0 ans 0 for y in x:
  if y==n:
    ans+=1 y x if y==n:
    ans+=1 y==n y n ans+=1 ans 1 print(ans) print ans ans=0 0 ans n,m=map(int,input().split()) map(int,input().split()) n ans+=1 1 ans x=[0]*m [0]*m x lis=list(map(int,input().split())) list(map(int,input().split())) lis m=map(int,input().split()) map(int,input().split()) m k=lis[0] lis[0] k a=lis[j]-1 lis[j]-1 a
n,m=map(int,input().split())
x=[0]*m
for i in range(0,n):
  lis=list(map(int,input().split()))
  k=lis[0]
  for j in range(1,k+1):
    a=lis[j]-1
    x[a]+=1

ans=0
for y in x:
  if y==n:
    ans+=1
print(ans)