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

for i in range(N):
    KA = list(map(int,input().split()))

    for k in range(1,KA[0]+1):
        like[KA[k]] += 1
        
ans = 0
for i in range(M+1):
    if like[i] == N:
        ans += 1

print(ans) N, M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M 0 for i in range(M+1) for i in range(M+1) i range(M+1) range M+1 M 1 for i in range(M+1) 0 like = [0 for i in range(M+1)] like [0 for i in range(M+1)] for i in range(N):
    KA = list(map(int,input().split()))

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

for i in range(N):
    KA = list(map(int,input().split()))

    for k in range(1,KA[0]+1):
        like[KA[k]] += 1
        
ans = 0
for i in range(M+1):
    if like[i] == N:
        ans += 1

print(ans)