N, M = map(int, input().split())

res = [0] * (M + 1)

for _ in range(N):
    A = list(map(int, input().split()))
    K = A.pop(0)
    for a in A:
        res[a] += 1

ans = 0

for r in res:
    if r == N:
        ans += 1

print(ans) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M res = [0] * (M + 1) res [0] * (M + 1) [0] 0 M + 1 M 1 for _ in range(N):
    A = list(map(int, input().split()))
    K = A.pop(0)
    for a in A:
        res[a] += 1 _ 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 K = A.pop(0) K A.pop(0) A.pop A pop 0 for a in A:
        res[a] += 1 a A res[a] += 1 res[a] res a 1 ans = 0 ans 0 for r in res:
    if r == N:
        ans += 1 r res if r == N:
        ans += 1 r == N r N ans += 1 ans 1 print(ans) print ans N, M = map(int, input().split()) map(int, input().split()) N res = [0] * (M + 1) [0] * (M + 1) res M = map(int, input().split()) map(int, input().split()) M A = list(map(int, input().split())) list(map(int, input().split())) A ans = 0 0 ans ans += 1 1 ans K = A.pop(0) A.pop(0) K
N, M = map(int, input().split())

res = [0] * (M + 1)

for _ in range(N):
    A = list(map(int, input().split()))
    K = A.pop(0)
    for a in A:
        res[a] += 1

ans = 0

for r in res:
    if r == N:
        ans += 1

print(ans)