N, M = map(int, input().split())
B = [0 for _ in range(M+1)]

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

for i in range(N):
    KA = list(map(int, input().split()))
    for a in KA[1:]:
        B[a] += 1
count = 0
for b in B:
    if b == N:
        count += 1
print(count)
