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

ans=sum(1 for x in mist if x==n)

print(ans) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m 0 for i in range(m) for i in range(m) i range(m) range m for i in range(m) 0 mist=[0 for i in range(m)] mist [0 for i in range(m)] for j in range(n):
    temp=list(map(int,input().split()))
    for s in range(1,len(temp)):
        mist[temp[s]-1]+=1 j range(n) range n temp=list(map(int,input().split())) temp list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for s in range(1,len(temp)):
        mist[temp[s]-1]+=1 s range(1,len(temp)) range 1 len(temp) len temp mist[temp[s]-1]+=1 mist[temp[s]-1] mist temp[s]-1 temp[s] temp s 1 1 ans=sum(1 for x in mist if x==n) ans sum(1 for x in mist if x==n) sum 1 print(ans) print ans mist=[0 for i in range(m)] [0 for i in range(m)] mist n,m=map(int,input().split()) map(int,input().split()) n temp=list(map(int,input().split())) list(map(int,input().split())) temp ans=sum(1 for x in mist if x==n) sum(1 for x in mist if x==n) ans m=map(int,input().split()) map(int,input().split()) m
n,m=map(int,input().split())
mist=[0 for i in range(m)]
for j in range(n):
    temp=list(map(int,input().split()))
    for s in range(1,len(temp)):
        mist[temp[s]-1]+=1

ans=sum(1 for x in mist if x==n)

print(ans)