n, m = map(int, input().split())
ka = [list(map(int, input().split())) for i in range(n)]
l = [True] * m
for i in ka:
  K = i[0]
  for j in range(m):
    if j+1 not in i[1:]:
      l[j] = False
print(l.count(True)) 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 i in range(n) for i in range(n) i range(n) range n for i 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 i in range(n)] ka [list(map(int, input().split())) for i in range(n)] l = [True] * m l [True] * m [True] True m for i in ka:
  K = i[0]
  for j in range(m):
    if j+1 not in i[1:]:
      l[j] = False i ka K = i[0] K i[0] i 0 for j in range(m):
    if j+1 not in i[1:]:
      l[j] = False j range(m) range m if j+1 not in i[1:]:
      l[j] = False j+1 not in i[1:] j+1 j 1 i[1:] i 1: 1 l[j] = False l[j] l j False print(l.count(True)) print l.count(True) l.count l count True n, m = map(int, input().split()) map(int, input().split()) n ka = [list(map(int, input().split())) for i in range(n)] [list(map(int, input().split())) for i in range(n)] ka l = [True] * m [True] * m l K = i[0] i[0] K m = map(int, input().split()) map(int, input().split()) m
n, m = map(int, input().split())
ka = [list(map(int, input().split())) for i in range(n)]
l = [True] * m
for i in ka:
  K = i[0]
  for j in range(m):
    if j+1 not in i[1:]:
      l[j] = False
print(l.count(True))