N,M = map(int,input().split())
LIKE = [True] * M

for i in range(N):
  KA = list(map(int,input().split()))
  A = KA[1:]
  
  for i in range(M):
    if not (i+1) in A:
      LIKE[i] = False
      
print(LIKE.count(True)) N,M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M LIKE = [True] * M LIKE [True] * M [True] True M for i in range(N):
  KA = list(map(int,input().split()))
  A = KA[1:]
  
  for i in range(M):
    if not (i+1) in A:
      LIKE[i] = False
       i range(N) range N KA = list(map(int,input().split())) KA list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split A = KA[1:] A KA[1:] KA 1: 1 for i in range(M):
    if not (i+1) in A:
      LIKE[i] = False
       i range(M) range M if not (i+1) in A:
      LIKE[i] = False
       not (i+1) in A (i+1) in A i+1 i 1 A LIKE[i] = False LIKE[i] LIKE i False print(LIKE.count(True)) print LIKE.count(True) LIKE.count LIKE count True M = map(int,input().split()) map(int,input().split()) M LIKE = [True] * M [True] * M LIKE KA = list(map(int,input().split())) list(map(int,input().split())) KA A = KA[1:] KA[1:] A N,M = map(int,input().split()) map(int,input().split()) N
N,M = map(int,input().split())
LIKE = [True] * M

for i in range(N):
  KA = list(map(int,input().split()))
  A = KA[1:]
  
  for i in range(M):
    if not (i+1) in A:
      LIKE[i] = False
      
print(LIKE.count(True))