n,m = map(int, input().split())

lis = []
for _ in range(n):
    lis.append(list(map(int, input().split())))
    
like =[0] * 31

for i in range(n):
    for j in lis[i][1:]:
        like[j] += 1
        
cnt = 0
for k in like:
    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 lis = [] lis [] for _ in range(n):
    lis.append(list(map(int, input().split())))
     _ range(n) range n lis.append(list(map(int, input().split()))) lis.append lis append list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split like =[0] * 31 like [0] * 31 [0] 0 31 for i in range(n):
    for j in lis[i][1:]:
        like[j] += 1
         i range(n) range n for j in lis[i][1:]:
        like[j] += 1
         j lis[i][1:] [i] lis i 1: 1 like[j] += 1 like[j] like j 1 cnt = 0 cnt 0 for k in like:
    if k == n:
        cnt += 1 k like if k == n:
        cnt += 1 k == n k n cnt += 1 cnt 1 print(cnt) print cnt like =[0] * 31 [0] * 31 like m = map(int, input().split()) map(int, input().split()) m cnt = 0 0 cnt lis = [] [] lis cnt += 1 1 cnt n,m = map(int, input().split()) map(int, input().split()) n
n,m = map(int, input().split())

lis = []
for _ in range(n):
    lis.append(list(map(int, input().split())))
    
like =[0] * 31

for i in range(n):
    for j in lis[i][1:]:
        like[j] += 1
        
cnt = 0
for k in like:
    if k == n:
        cnt += 1

print(cnt)