N,M = map(int,input().split())
L = [0]*31

for n in range(N):
  K,*A = map(int,input().split())
  for a in A:
    L[a]+=1
    
print(L.count(N)) N,M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M L = [0]*31 L [0]*31 [0] 0 31 for n in range(N):
  K,*A = map(int,input().split())
  for a in A:
    L[a]+=1
     n range(N) range N K,*A = map(int,input().split()) K map(int,input().split()) map int input().split() ().split () input split *A A for a in A:
    L[a]+=1
     a A L[a]+=1 L[a] L a 1 print(L.count(N)) print L.count(N) L.count L count N L = [0]*31 [0]*31 L K,*A = map(int,input().split()) map(int,input().split()) K N,M = map(int,input().split()) map(int,input().split()) N M = map(int,input().split()) map(int,input().split()) M
N,M = map(int,input().split())
L = [0]*31

for n in range(N):
  K,*A = map(int,input().split())
  for a in A:
    L[a]+=1
    
print(L.count(N))