N,M = map(int, input().split())

B = [0]*30

for i in range(N):
	K, *A = map(int, input().split())
	for a in A:
		B[a-1] += 1

print(sum(c == N for c in B)) N,M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M B = [0]*30 B [0]*30 [0] 0 30 for i in range(N):
	K, *A = map(int, input().split())
	for a in A:
		B[a-1] += 1 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 for a in A:
		B[a-1] += 1 a A B[a-1] += 1 B[a-1] B a-1 a 1 1 print(sum(c == N for c in B)) print sum(c == N for c in B) sum c == N c N B = [0]*30 [0]*30 B K, *A = map(int, input().split()) 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())

B = [0]*30

for i in range(N):
	K, *A = map(int, input().split())
	for a in A:
		B[a-1] += 1

print(sum(c == N for c in B))