n,m=map(int,input().split())

l=[]
for i in range(n):
  p=list(map(int,input().split()))
  for j in range(1,p[0]+1):
    l.append(p[j])

cnt=0

for k in l:
  if l.count(k)==n:
    cnt+=1

print(cnt//n) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m l=[] l [] for i in range(n):
  p=list(map(int,input().split()))
  for j in range(1,p[0]+1):
    l.append(p[j]) i range(n) range n p=list(map(int,input().split())) p list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for j in range(1,p[0]+1):
    l.append(p[j]) j range(1,p[0]+1) range 1 p[0]+1 p[0] p 0 1 l.append(p[j]) l.append l append p[j] p j cnt=0 cnt 0 for k in l:
  if l.count(k)==n:
    cnt+=1 k l if l.count(k)==n:
    cnt+=1 l.count(k)==n l.count(k) l.count l count k n cnt+=1 cnt 1 print(cnt//n) print cnt//n cnt n m=map(int,input().split()) map(int,input().split()) m n,m=map(int,input().split()) map(int,input().split()) n cnt=0 0 cnt cnt+=1 1 cnt p=list(map(int,input().split())) list(map(int,input().split())) p l=[] [] l
n,m=map(int,input().split())

l=[]
for i in range(n):
  p=list(map(int,input().split()))
  for j in range(1,p[0]+1):
    l.append(p[j])

cnt=0

for k in l:
  if l.count(k)==n:
    cnt+=1

print(cnt//n)