N,M = map(int,input().split())
foods = [0]*M
 
for i in range(N):
  KA = list(map(int,input().split()))
  
  for a in KA[1:]:
    foods[a-1] += 1
  
cnt = 0
for j in foods:
  if j == N:
    cnt += 1
    
print(cnt) N,M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M foods = [0]*M foods [0]*M [0] 0 M for i in range(N):
  KA = list(map(int,input().split()))
  
  for a in KA[1:]:
    foods[a-1] += 1
   i range(N) range N KA = list(map(int,input().split())) KA list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for a in KA[1:]:
    foods[a-1] += 1
   a KA[1:] KA 1: 1 foods[a-1] += 1 foods[a-1] foods a-1 a 1 1 cnt = 0 cnt 0 for j in foods:
  if j == N:
    cnt += 1
     j foods if j == N:
    cnt += 1
     j == N j N cnt += 1 cnt 1 print(cnt) print cnt foods = [0]*M [0]*M foods N,M = map(int,input().split()) map(int,input().split()) N cnt = 0 0 cnt KA = list(map(int,input().split())) list(map(int,input().split())) KA cnt += 1 1 cnt M = map(int,input().split()) map(int,input().split()) M
N,M = map(int,input().split())
foods = [0]*M
 
for i in range(N):
  KA = list(map(int,input().split()))
  
  for a in KA[1:]:
    foods[a-1] += 1
  
cnt = 0
for j in foods:
  if j == N:
    cnt += 1
    
print(cnt)