n,m=map(int,input().split())
x=[]
sum=0
for i in range(n):
  s=list(map(int,input().split()))
  s.pop(0)
  x+=s
for j in range(1,m+1):
  if x.count(j)==n:
    sum+=1
print(sum) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m x=[] x [] sum=0 sum 0 for i in range(n):
  s=list(map(int,input().split()))
  s.pop(0)
  x+=s i range(n) range n s=list(map(int,input().split())) s list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split s.pop(0) s.pop s pop 0 x+=s x s for j in range(1,m+1):
  if x.count(j)==n:
    sum+=1 j range(1,m+1) range 1 m+1 m 1 if x.count(j)==n:
    sum+=1 x.count(j)==n x.count(j) x.count x count j n sum+=1 sum 1 print(sum) print sum sum+=1 1 sum m=map(int,input().split()) map(int,input().split()) m sum=0 0 sum n,m=map(int,input().split()) map(int,input().split()) n x+=s s x s=list(map(int,input().split())) list(map(int,input().split())) s x=[] [] x
n,m=map(int,input().split())
x=[]
sum=0
for i in range(n):
  s=list(map(int,input().split()))
  s.pop(0)
  x+=s
for j in range(1,m+1):
  if x.count(j)==n:
    sum+=1
print(sum)
