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