n,m=map(int,input().split())
c=[]
cnt=0
for i in range(n):
    a=list(map(int,input().split()))
    for j in range(1,len(a)):
        c.append(a[j])
    
for j in range(1,m+1):
    if c.count(j)==n:
        cnt += 1
print(cnt) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m c=[] c [] cnt=0 cnt 0 for i in range(n):
    a=list(map(int,input().split()))
    for j in range(1,len(a)):
        c.append(a[j])
     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 range(1,len(a)):
        c.append(a[j])
     j range(1,len(a)) range 1 len(a) len a c.append(a[j]) c.append c append a[j] a j for j in range(1,m+1):
    if c.count(j)==n:
        cnt += 1 j range(1,m+1) range 1 m+1 m 1 if c.count(j)==n:
        cnt += 1 c.count(j)==n c.count(j) c.count c count j n cnt += 1 cnt 1 print(cnt) print cnt a=list(map(int,input().split())) list(map(int,input().split())) a cnt=0 0 cnt c=[] [] c m=map(int,input().split()) map(int,input().split()) m cnt += 1 1 cnt n,m=map(int,input().split()) map(int,input().split()) n
n,m=map(int,input().split())
c=[]
cnt=0
for i in range(n):
    a=list(map(int,input().split()))
    for j in range(1,len(a)):
        c.append(a[j])
    
for j in range(1,m+1):
    if c.count(j)==n:
        cnt += 1
print(cnt)
