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