n, m = map(int, input().split())
an = []

for i in range(n):
  l = [int(num) for num in input().split()]
  an.append(l[1:])

check = {}
for i in an:
  for j in i:
    if j not in check:
      check[j] = 1
    else :
      check[j] += 1

answer = 0
for v in check.values() :
  if v == n:
    answer +=1
      
print(answer) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m an = [] an [] for i in range(n):
  l = [int(num) for num in input().split()]
  an.append(l[1:]) i range(n) range n int(num) for num in input().split() for num in input().split() num input().split() ().split () input split for num in input().split() int(num) int num l = [int(num) for num in input().split()] l [int(num) for num in input().split()] an.append(l[1:]) an.append an append l[1:] l 1: 1 check = {} check {} for i in an:
  for j in i:
    if j not in check:
      check[j] = 1
    else :
      check[j] += 1 i an for j in i:
    if j not in check:
      check[j] = 1
    else :
      check[j] += 1 j i if j not in check:
      check[j] = 1
    else :
      check[j] += 1 j not in check j check check[j] = 1 check[j] check j 1 check[j] += 1 check[j] check j 1 answer = 0 answer 0 for v in check.values() :
  if v == n:
    answer +=1
       v check.values() check.values check values if v == n:
    answer +=1
       v == n v n answer +=1 answer 1 print(answer) print answer n, m = map(int, input().split()) map(int, input().split()) n check = {} {} check answer = 0 0 answer m = map(int, input().split()) map(int, input().split()) m answer +=1 1 answer an = [] [] an l = [int(num) for num in input().split()] [int(num) for num in input().split()] l
n, m = map(int, input().split())
an = []

for i in range(n):
  l = [int(num) for num in input().split()]
  an.append(l[1:])

check = {}
for i in an:
  for j in i:
    if j not in check:
      check[j] = 1
    else :
      check[j] += 1

answer = 0
for v in check.values() :
  if v == n:
    answer +=1
      
print(answer)