N,M=map(int,input().split())
food=set(range(1,M+1))
for i in range(N):
    A=map(int,input().split()[1:])
    food&=set(A)
print(len(food)) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M food=set(range(1,M+1)) food set(range(1,M+1)) set range(1,M+1) range 1 M+1 M 1 for i in range(N):
    A=map(int,input().split()[1:])
    food&=set(A) i range(N) range N A=map(int,input().split()[1:]) A map(int,input().split()[1:]) map int input().split()[1:] ().split() ().split () input split 1: 1 food&=set(A) food set(A) set A print(len(food)) print len(food) len food N,M=map(int,input().split()) map(int,input().split()) N food&=set(A) set(A) food food=set(range(1,M+1)) set(range(1,M+1)) food M=map(int,input().split()) map(int,input().split()) M A=map(int,input().split()[1:]) map(int,input().split()[1:]) A
N,M=map(int,input().split())
food=set(range(1,M+1))
for i in range(N):
    A=map(int,input().split()[1:])
    food&=set(A)
print(len(food))