import numpy as np
N, M = map(int, input().split())
ans = np.zeros(M)
for i in range(N):
  KA = list(map(int, input().split()))
  for j in range(KA[0]):
    idx = KA[j+1]-1
    ans[idx] += 1

count = 0
for i in range(M):
  if ans[i] == N:
    count += 1
print(count) import numpy as np numpy N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M ans = np.zeros(M) ans np.zeros(M) np.zeros np zeros M for i in range(N):
  KA = list(map(int, input().split()))
  for j in range(KA[0]):
    idx = KA[j+1]-1
    ans[idx] += 1 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 for j in range(KA[0]):
    idx = KA[j+1]-1
    ans[idx] += 1 j range(KA[0]) range KA[0] KA 0 idx = KA[j+1]-1 idx KA[j+1]-1 KA[j+1] KA j+1 j 1 1 ans[idx] += 1 ans[idx] ans idx 1 count = 0 count 0 for i in range(M):
  if ans[i] == N:
    count += 1 i range(M) range M if ans[i] == N:
    count += 1 ans[i] == N ans[i] ans i N count += 1 count 1 print(count) print count ans = np.zeros(M) np.zeros(M) ans KA = list(map(int, input().split())) list(map(int, input().split())) KA N, M = map(int, input().split()) map(int, input().split()) N M = map(int, input().split()) map(int, input().split()) M count = 0 0 count idx = KA[j+1]-1 KA[j+1]-1 idx count += 1 1 count
import numpy as np
N, M = map(int, input().split())
ans = np.zeros(M)
for i in range(N):
  KA = list(map(int, input().split()))
  for j in range(KA[0]):
    idx = KA[j+1]-1
    ans[idx] += 1

count = 0
for i in range(M):
  if ans[i] == N:
    count += 1
print(count)