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