N, M = map(int, input().split())
t = [0 for i in range(M+1)]
for i in range(N):
  A = list(map(int, input().split()))
  for j in range(1, A[0]+1):
    t[ A[j] ] += 1
ans = 0
for i in t:
  if i == N:
    ans += 1
print(ans) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M 0 for i in range(M+1) for i in range(M+1) i range(M+1) range M+1 M 1 for i in range(M+1) 0 t = [0 for i in range(M+1)] t [0 for i in range(M+1)] for i in range(N):
  A = list(map(int, input().split()))
  for j in range(1, A[0]+1):
    t[ A[j] ] += 1 i range(N) range N A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for j in range(1, A[0]+1):
    t[ A[j] ] += 1 j range(1, A[0]+1) range 1 A[0]+1 A[0] A 0 1 t[ A[j] ] += 1 t[ A[j] ] t A[j] A j 1 ans = 0 ans 0 for i in t:
  if i == N:
    ans += 1 i t if i == N:
    ans += 1 i == N i N ans += 1 ans 1 print(ans) print ans A = list(map(int, input().split())) list(map(int, input().split())) A ans = 0 0 ans t = [0 for i in range(M+1)] [0 for i in range(M+1)] t ans += 1 1 ans N, M = map(int, input().split()) map(int, input().split()) N M = map(int, input().split()) map(int, input().split()) M
N, M = map(int, input().split())
t = [0 for i in range(M+1)]
for i in range(N):
  A = list(map(int, input().split()))
  for j in range(1, A[0]+1):
    t[ A[j] ] += 1
ans = 0
for i in t:
  if i == N:
    ans += 1
print(ans)
