n,m = map(int,input().split())
A=[0]*(m+1)
for i in range(n):
    K = list(map(int,input().split()))
    for j in range(1,len(K)):
        A[K[j]]+=1
print(A.count(n)) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m A=[0]*(m+1) A [0]*(m+1) [0] 0 m+1 m 1 for i in range(n):
    K = list(map(int,input().split()))
    for j in range(1,len(K)):
        A[K[j]]+=1 i range(n) range n K = list(map(int,input().split())) K list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for j in range(1,len(K)):
        A[K[j]]+=1 j range(1,len(K)) range 1 len(K) len K A[K[j]]+=1 A[K[j]] A K[j] K j 1 print(A.count(n)) print A.count(n) A.count A count n A=[0]*(m+1) [0]*(m+1) A K = list(map(int,input().split())) list(map(int,input().split())) K n,m = map(int,input().split()) map(int,input().split()) n m = map(int,input().split()) map(int,input().split()) m
n,m = map(int,input().split())
A=[0]*(m+1)
for i in range(n):
    K = list(map(int,input().split()))
    for j in range(1,len(K)):
        A[K[j]]+=1
print(A.count(n))
