N,M=map(int,input().split())
A=[map(int,input().split()[1:]) for i in range(N)]
food=set(range(1,M+1))
for i in range(N):
    food&=set(A[i])
print(len(food)) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M map(int,input().split()[1:]) for i in range(N) for i in range(N) i range(N) range N for i in range(N) map(int,input().split()[1:]) map int input().split()[1:] ().split() ().split () input split 1: 1 A=[map(int,input().split()[1:]) for i in range(N)] A [map(int,input().split()[1:]) for i in range(N)] 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):
    food&=set(A[i]) i range(N) range N food&=set(A[i]) food set(A[i]) set A[i] A i print(len(food)) print len(food) len food A=[map(int,input().split()[1:]) for i in range(N)] [map(int,input().split()[1:]) for i in range(N)] A food=set(range(1,M+1)) set(range(1,M+1)) food N,M=map(int,input().split()) map(int,input().split()) N food&=set(A[i]) set(A[i]) food M=map(int,input().split()) map(int,input().split()) M
N,M=map(int,input().split())
A=[map(int,input().split()[1:]) for i in range(N)]
food=set(range(1,M+1))
for i in range(N):
    food&=set(A[i])
print(len(food))