N, M = map(int, input().split())
ans = [0]*M

for _ in range(N):
  K, *A = map(int, input().split())
  for x in A:
    ans[x-1] += 1

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

for _ in range(N):
  K, *A = map(int, input().split())
  for x in A:
    ans[x-1] += 1

print(sum([1 for i in ans if i == N]))