n,m=map(int,input().split())
S=set(range(1,m+1))
for i in range(n):
    K,*A=map(int,input().split())
    S&=set(A)
print(len(S)) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m S=set(range(1,m+1)) S set(range(1,m+1)) set range(1,m+1) range 1 m+1 m 1 for i in range(n):
    K,*A=map(int,input().split())
    S&=set(A) i range(n) range n K,*A=map(int,input().split()) K map(int,input().split()) map int input().split() ().split () input split *A A S&=set(A) S set(A) set A print(len(S)) print len(S) len S S=set(range(1,m+1)) set(range(1,m+1)) S m=map(int,input().split()) map(int,input().split()) m K,*A=map(int,input().split()) map(int,input().split()) K S&=set(A) set(A) S n,m=map(int,input().split()) map(int,input().split()) n
n,m=map(int,input().split())
S=set(range(1,m+1))
for i in range(n):
    K,*A=map(int,input().split())
    S&=set(A)
print(len(S))