N,M=map(int,input().split())
l=list()
for i in range(N):
    A=list(map(int,input().split()))
    del A[0]
    l+=A
result=0
for i in range(M):
    if l.count(i+1)==N:
        result+=1
print(result) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M l=list() l list() list for i in range(N):
    A=list(map(int,input().split()))
    del A[0]
    l+=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 l+=A l A result=0 result 0 for i in range(M):
    if l.count(i+1)==N:
        result+=1 i range(M) range M if l.count(i+1)==N:
        result+=1 l.count(i+1)==N l.count(i+1) l.count l count i+1 i 1 N result+=1 result 1 print(result) print result l=list() list() l A=list(map(int,input().split())) list(map(int,input().split())) A N,M=map(int,input().split()) map(int,input().split()) N l+=A A l result+=1 1 result M=map(int,input().split()) map(int,input().split()) M result=0 0 result
N,M=map(int,input().split())
l=list()
for i in range(N):
    A=list(map(int,input().split()))
    del A[0]
    l+=A
result=0
for i in range(M):
    if l.count(i+1)==N:
        result+=1
print(result)
