n, m = map(int, input().split())
KA =[list(map(int, input().split())) for _ in range(n)]

cnt = [0]*m
for ka in KA:
  for a in ka[1:]:
    cnt[a-1] += 1

ans = 0
for i in cnt:
  if i == n:
    ans += 1
print(ans) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m list(map(int, input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split KA =[list(map(int, input().split())) for _ in range(n)] KA [list(map(int, input().split())) for _ in range(n)] cnt = [0]*m cnt [0]*m [0] 0 m for ka in KA:
  for a in ka[1:]:
    cnt[a-1] += 1 ka KA for a in ka[1:]:
    cnt[a-1] += 1 a ka[1:] ka 1: 1 cnt[a-1] += 1 cnt[a-1] cnt a-1 a 1 1 ans = 0 ans 0 for i in cnt:
  if i == n:
    ans += 1 i cnt if i == n:
    ans += 1 i == n i n ans += 1 ans 1 print(ans) print ans n, m = map(int, input().split()) map(int, input().split()) n cnt = [0]*m [0]*m cnt ans += 1 1 ans ans = 0 0 ans KA =[list(map(int, input().split())) for _ in range(n)] [list(map(int, input().split())) for _ in range(n)] KA m = map(int, input().split()) map(int, input().split()) m
n, m = map(int, input().split())
KA =[list(map(int, input().split())) for _ in range(n)]

cnt = [0]*m
for ka in KA:
  for a in ka[1:]:
    cnt[a-1] += 1

ans = 0
for i in cnt:
  if i == n:
    ans += 1
print(ans)
