N, M = map(int, input().split())
K_A = [list(map(int, input().split())) for _ in range(N)]
candidate = {i for i in range(1, M + 1)}
for line in K_A:
    candidate = candidate & set(line[1:])
print(len(candidate)) 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 _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split K_A = [list(map(int, input().split())) for _ in range(N)] K_A [list(map(int, input().split())) for _ in range(N)] i for i in range(1, M + 1) for i in range(1, M + 1) i range(1, M + 1) range 1 M + 1 M 1 for i in range(1, M + 1) i candidate = {i for i in range(1, M + 1)} candidate for line in K_A:
    candidate = candidate & set(line[1:]) line K_A candidate = candidate & set(line[1:]) candidate candidate & set(line[1:]) candidate set(line[1:]) set line[1:] line 1: 1 print(len(candidate)) print len(candidate) len candidate K_A = [list(map(int, input().split())) for _ in range(N)] [list(map(int, input().split())) for _ in range(N)] K_A N, M = map(int, input().split()) map(int, input().split()) N candidate = candidate & set(line[1:]) candidate & set(line[1:]) candidate M = map(int, input().split()) map(int, input().split()) M candidate = {i for i in range(1, M + 1)} candidate
N, M = map(int, input().split())
K_A = [list(map(int, input().split())) for _ in range(N)]
candidate = {i for i in range(1, M + 1)}
for line in K_A:
    candidate = candidate & set(line[1:])
print(len(candidate))
