n,m=map(int,input().split())
l=[0]*m
for i in range(n):
    s=list(map(int,input().split()))
    for j in range(1,len(s)):
        l[s[j]-1]+=1
print(l.count(n)) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m l=[0]*m l [0]*m [0] 0 m for i in range(n):
    s=list(map(int,input().split()))
    for j in range(1,len(s)):
        l[s[j]-1]+=1 i range(n) range n s=list(map(int,input().split())) s list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for j in range(1,len(s)):
        l[s[j]-1]+=1 j range(1,len(s)) range 1 len(s) len s l[s[j]-1]+=1 l[s[j]-1] l s[j]-1 s[j] s j 1 1 print(l.count(n)) print l.count(n) l.count l count n l=[0]*m [0]*m l n,m=map(int,input().split()) map(int,input().split()) n m=map(int,input().split()) map(int,input().split()) m s=list(map(int,input().split())) list(map(int,input().split())) s
n,m=map(int,input().split())
l=[0]*m
for i in range(n):
    s=list(map(int,input().split()))
    for j in range(1,len(s)):
        l[s[j]-1]+=1
print(l.count(n))