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