N,M = map(int, input().split())

A=[]
for i in range(N):
  x = [int(i) for i in input().split()]
  A = A + x[1:]

ans = 0
from collections import Counter
for k,v in Counter(A).items():
  # print(k,v)
  if v==N: ans += 1

print(ans) N,M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M A=[] A [] for i in range(N):
  x = [int(i) for i in input().split()]
  A = A + x[1:] i range(N) range N int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i x = [int(i) for i in input().split()] x [int(i) for i in input().split()] A = A + x[1:] A A + x[1:] A x[1:] x 1: 1 ans = 0 ans 0 from collections import Counter for k,v in Counter(A).items():
  # print(k,v)
  if v==N: ans += 1 k v Counter(A).items() (A).items (A) Counter A items if v==N: ans += v==N v N print(ans) print ans A = A + x[1:] A + x[1:] A ans = 0 0 ans N,M = map(int, input().split()) map(int, input().split()) N M = map(int, input().split()) map(int, input().split()) M A=[] [] A x = [int(i) for i in input().split()] [int(i) for i in input().split()] x
N,M = map(int, input().split())

A=[]
for i in range(N):
  x = [int(i) for i in input().split()]
  A = A + x[1:]

ans = 0
from collections import Counter
for k,v in Counter(A).items():
  # print(k,v)
  if v==N: ans += 1

print(ans)
