N,M=map(int,input().split())
KA=[]
A=[]
a=0
for i in range(N):
    KA.append(list(map(int,input().split())))
for i in range(N):
    KA[i].remove(KA[i][0])
for i in range(N):
    for j in range(len(KA[i])):
        A.append(KA[i][j])
for i in range(1,M+1):
    if N==A.count(i):
        a+=1
print(a) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M KA=[] KA [] A=[] A [] a=0 a 0 for i in range(N):
    KA.append(list(map(int,input().split()))) i range(N) range N KA.append(list(map(int,input().split()))) KA.append KA append list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for i in range(N):
    KA[i].remove(KA[i][0]) i range(N) range N KA[i].remove(KA[i][0]) [i].remove [i] KA i remove KA[i][0] [i] KA i 0 for i in range(N):
    for j in range(len(KA[i])):
        A.append(KA[i][j]) i range(N) range N for j in range(len(KA[i])):
        A.append(KA[i][j]) j range(len(KA[i])) range len(KA[i]) len KA[i] KA i A.append(KA[i][j]) A.append A append KA[i][j] [i] KA i j for i in range(1,M+1):
    if N==A.count(i):
        a+=1 i range(1,M+1) range 1 M+1 M 1 if N==A.count(i):
        a+=1 N==A.count(i) N A.count(i) A.count A count i a+=1 a 1 print(a) print a N,M=map(int,input().split()) map(int,input().split()) N a+=1 1 a M=map(int,input().split()) map(int,input().split()) M a=0 0 a KA=[] [] KA A=[] [] A
N,M=map(int,input().split())
KA=[]
A=[]
a=0
for i in range(N):
    KA.append(list(map(int,input().split())))
for i in range(N):
    KA[i].remove(KA[i][0])
for i in range(N):
    for j in range(len(KA[i])):
        A.append(KA[i][j])
for i in range(1,M+1):
    if N==A.count(i):
        a+=1
print(a)