N,M=map(int,input().split())
l=[list(map(int,input().split())) for i in range(N)]

ans = [0]*(M+1)
for i in range(N):
	for j in range(l[i][0]):
		ans[(l[i][j+1])] += 1

print(ans.count(N)) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M list(map(int,input().split())) for i in range(N) for i in range(N) i range(N) range N for i in range(N) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split l=[list(map(int,input().split())) for i in range(N)] l [list(map(int,input().split())) for i in range(N)] ans = [0]*(M+1) ans [0]*(M+1) [0] 0 M+1 M 1 for i in range(N):
	for j in range(l[i][0]):
		ans[(l[i][j+1])] += 1 i range(N) range N for j in range(l[i][0]):
		ans[(l[i][j+1])] += 1 j range(l[i][0]) range l[i][0] [i] l i 0 ans[(l[i][j+1])] += 1 ans[(l[i][j+1])] ans l[i][j+1] [i] l i j+1 j 1 1 print(ans.count(N)) print ans.count(N) ans.count ans count N ans = [0]*(M+1) [0]*(M+1) ans N,M=map(int,input().split()) map(int,input().split()) N M=map(int,input().split()) map(int,input().split()) M l=[list(map(int,input().split())) for i in range(N)] [list(map(int,input().split())) for i in range(N)] l
N,M=map(int,input().split())
l=[list(map(int,input().split())) for i in range(N)]

ans = [0]*(M+1)
for i in range(N):
	for j in range(l[i][0]):
		ans[(l[i][j+1])] += 1

print(ans.count(N))