N,M=map(int,input().split())
n = [0]*(M+1)
for i in range(N):
  K,*A=map(int,input().split())
  for j in range(K):
    n[A[j]] += 1

count = 0
for i in range(len(n)):
  if n[i]==N:count += 1

print(count) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M n = [0]*(M+1) n [0]*(M+1) [0] 0 M+1 M 1 for i in range(N):
  K,*A=map(int,input().split())
  for j in range(K):
    n[A[j]] += 1 i range(N) range N K,*A=map(int,input().split()) K map(int,input().split()) map int input().split() ().split () input split *A A for j in range(K):
    n[A[j]] += 1 j range(K) range K n[A[j]] += 1 n[A[j]] n A[j] A j 1 count = 0 count 0 for i in range(len(n)):
  if n[i]==N:count += 1 i range(len(n)) range len(n) len n if n[i]==N:count += n[i]==N n[i] n i N print(count) print count N,M=map(int,input().split()) map(int,input().split()) N M=map(int,input().split()) map(int,input().split()) M K,*A=map(int,input().split()) map(int,input().split()) K count = 0 0 count n = [0]*(M+1) [0]*(M+1) n
N,M=map(int,input().split())
n = [0]*(M+1)
for i in range(N):
  K,*A=map(int,input().split())
  for j in range(K):
    n[A[j]] += 1

count = 0
for i in range(len(n)):
  if n[i]==N:count += 1

print(count)