N,M=map(int,input().split())
b=[]
s=[0]*M
for i in range(N):
    a=list(map(int,input().split()))
    del a[0]
    a.sort()
    b.append(a)
for i in range(N):
    for j in range(len(b[i])):
        s[b[i][j]-1]+=1
print(s.count(N)) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M b=[] b [] s=[0]*M s [0]*M [0] 0 M for i in range(N):
    a=list(map(int,input().split()))
    del a[0]
    a.sort()
    b.append(a) i range(N) range N a=list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split del a[0] a[0] a 0 a.sort() a.sort a sort b.append(a) b.append b append a for i in range(N):
    for j in range(len(b[i])):
        s[b[i][j]-1]+=1 i range(N) range N for j in range(len(b[i])):
        s[b[i][j]-1]+=1 j range(len(b[i])) range len(b[i]) len b[i] b i s[b[i][j]-1]+=1 s[b[i][j]-1] s b[i][j]-1 b[i][j] [i] b i j 1 1 print(s.count(N)) print s.count(N) s.count s count N M=map(int,input().split()) map(int,input().split()) M b=[] [] b N,M=map(int,input().split()) map(int,input().split()) N a=list(map(int,input().split())) list(map(int,input().split())) a s=[0]*M [0]*M s
N,M=map(int,input().split())
b=[]
s=[0]*M
for i in range(N):
    a=list(map(int,input().split()))
    del a[0]
    a.sort()
    b.append(a)
for i in range(N):
    for j in range(len(b[i])):
        s[b[i][j]-1]+=1
print(s.count(N))