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