n,m = map(int, input().split())
l = dict()
for i in range(1,m+1):
  l[i] = 0

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

cnt = 0
for k,v in l.items():
  if v==n:
    cnt += 1
print(cnt) n,m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m l = dict() l dict() dict for i in range(1,m+1):
  l[i] = 0 i range(1,m+1) range 1 m+1 m 1 l[i] = 0 l[i] l i 0 for i in range(n):
  x = list(map(int, input().split()))
  k = x[0]
  for j in x[1:]:
    l[j] += 1 i range(n) range n x = list(map(int, input().split())) x list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k = x[0] k x[0] x 0 for j in x[1:]:
    l[j] += 1 j x[1:] x 1: 1 l[j] += 1 l[j] l j 1 cnt = 0 cnt 0 for k,v in l.items():
  if v==n:
    cnt += 1 k v l.items() l.items l items if v==n:
    cnt += 1 v==n v n cnt += 1 cnt 1 print(cnt) print cnt l = dict() dict() l k = x[0] x[0] k cnt += 1 1 cnt n,m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m cnt = 0 0 cnt x = list(map(int, input().split())) list(map(int, input().split())) x
n,m = map(int, input().split())
l = dict()
for i in range(1,m+1):
  l[i] = 0

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

cnt = 0
for k,v in l.items():
  if v==n:
    cnt += 1
print(cnt)