n,m= map(int,input().split())
unti= [0] * (m+1)
ans=0
for i in range(n):
    x = list(map(int,input().split()))
    for j in range(x[0]):
        unti[x[j+1]]+=1
for i in range(m+1):
    if unti[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 unti= [0] * (m+1) unti [0] * (m+1) [0] 0 m+1 m 1 ans=0 ans 0 for i in range(n):
    x = list(map(int,input().split()))
    for j in range(x[0]):
        unti[x[j+1]]+=1 i range(n) range n x = list(map(int,input().split())) x list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for j in range(x[0]):
        unti[x[j+1]]+=1 j range(x[0]) range x[0] x 0 unti[x[j+1]]+=1 unti[x[j+1]] unti x[j+1] x j+1 j 1 1 for i in range(m+1):
    if unti[i] == n:
        ans+=1 i range(m+1) range m+1 m 1 if unti[i] == n:
        ans+=1 unti[i] == n unti[i] unti i n ans+=1 ans 1 print(ans) print ans x = list(map(int,input().split())) list(map(int,input().split())) x ans=0 0 ans unti= [0] * (m+1) [0] * (m+1) unti n,m= map(int,input().split()) map(int,input().split()) n m= map(int,input().split()) map(int,input().split()) m ans+=1 1 ans
n,m= map(int,input().split())
unti= [0] * (m+1)
ans=0
for i in range(n):
    x = list(map(int,input().split()))
    for j in range(x[0]):
        unti[x[j+1]]+=1
for i in range(m+1):
    if unti[i] == n:
        ans+=1
print(ans)