N, M = map(int, input().split())
A = []
for _ in range(N):
    KA = list(map(int, input().split()))
    A.append(KA[1:])
ans = [0]*M
for a in A:
    for i in a:
        ans[i-1] += 1
print(ans.count(N)) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M A = [] A [] for _ in range(N):
    KA = list(map(int, input().split()))
    A.append(KA[1:]) _ 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 A.append(KA[1:]) A.append A append KA[1:] KA 1: 1 ans = [0]*M ans [0]*M [0] 0 M for a in A:
    for i in a:
        ans[i-1] += 1 a A for i in a:
        ans[i-1] += 1 i a ans[i-1] += 1 ans[i-1] ans i-1 i 1 1 print(ans.count(N)) print ans.count(N) ans.count ans count N ans = [0]*M [0]*M ans N, M = map(int, input().split()) map(int, input().split()) N M = map(int, input().split()) map(int, input().split()) M KA = list(map(int, input().split())) list(map(int, input().split())) KA A = [] [] A
N, M = map(int, input().split())
A = []
for _ in range(N):
    KA = list(map(int, input().split()))
    A.append(KA[1:])
ans = [0]*M
for a in A:
    for i in a:
        ans[i-1] += 1
print(ans.count(N))