N, M = list(map(int, input().split()))
B = [True] * M
for i in range(N):
    A = list(map(int, input().split()))[1:]
    _B = [False] * M
    for a in A:
        _B[a - 1] = True
    B = list(map(lambda x: x[0] and x[1], zip(B, _B)))
print(sum(filter(lambda x: x, B))) N, M = list(map(int, input().split())) N list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split M B = [True] * M B [True] * M [True] True M for i in range(N):
    A = list(map(int, input().split()))[1:]
    _B = [False] * M
    for a in A:
        _B[a - 1] = True
    B = list(map(lambda x: x[0] and x[1], zip(B, _B))) i range(N) range N A = list(map(int, input().split()))[1:] A list(map(int, input().split()))[1:] (map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split 1: 1 _B = [False] * M _B [False] * M [False] False M for a in A:
        _B[a - 1] = True
     a A _B[a - 1] = True _B[a - 1] _B a - 1 a 1 True B = list(map(lambda x: x[0] and x[1], zip(B, _B))) B list(map(lambda x: x[0] and x[1], zip(B, _B))) list map(lambda x: x[0] and x[1], zip(B, _B)) map lambda x: x[0] and x[1] x[0] and x[1] x[0] x 0 x[1] x 1 x zip(B, _B) zip B _B print(sum(filter(lambda x: x, B))) print sum(filter(lambda x: x, B)) sum filter(lambda x: x, B) filter lambda x: x x x B _B = [False] * M [False] * M _B A = list(map(int, input().split()))[1:] list(map(int, input().split()))[1:] A B = [True] * M [True] * M B B = list(map(lambda x: x[0] and x[1], zip(B, _B))) list(map(lambda x: x[0] and x[1], zip(B, _B))) B N, M = list(map(int, input().split())) list(map(int, input().split())) N M = list(map(int, input().split())) list(map(int, input().split())) M
N, M = list(map(int, input().split()))
B = [True] * M
for i in range(N):
    A = list(map(int, input().split()))[1:]
    _B = [False] * M
    for a in A:
        _B[a - 1] = True
    B = list(map(lambda x: x[0] and x[1], zip(B, _B)))
print(sum(filter(lambda x: x, B)))
