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

S = set(i for i in range(1, M + 1))
for i in range(N):
    K, *A = map(int, input().split())
    S &= set(A)
print(len(S)) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M S = set(i for i in range(1, M + 1)) S set(i for i in range(1, M + 1)) set i for i in range(N):
    K, *A = map(int, input().split())
    S &= set(A) 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 S &= set(A) S set(A) set A print(len(S)) print len(S) len S N, M = map(int, input().split()) map(int, input().split()) N K, *A = map(int, input().split()) map(int, input().split()) K M = map(int, input().split()) map(int, input().split()) M S &= set(A) set(A) S S = set(i for i in range(1, M + 1)) set(i for i in range(1, M + 1)) S
N, M = map(int, input().split())

S = set(i for i in range(1, M + 1))
for i in range(N):
    K, *A = map(int, input().split())
    S &= set(A)
print(len(S))
