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