N, M = map(int, input().split())
res = set(list(range(1, M+1)))
for _ in range(N):
    k, *a = map(int, input().split())
    res = res.intersection(a)
print(len(res)) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M res = set(list(range(1, M+1))) res set(list(range(1, M+1))) set list(range(1, M+1)) list range(1, M+1) range 1 M+1 M 1 for _ in range(N):
    k, *a = map(int, input().split())
    res = res.intersection(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 res = res.intersection(a) res res.intersection(a) res.intersection res intersection a print(len(res)) print len(res) len res res = set(list(range(1, M+1))) set(list(range(1, M+1))) res N, M = map(int, input().split()) map(int, input().split()) N k, *a = map(int, input().split()) map(int, input().split()) k res = res.intersection(a) res.intersection(a) res M = map(int, input().split()) map(int, input().split()) M
N, M = map(int, input().split())
res = set(list(range(1, M+1)))
for _ in range(N):
    k, *a = map(int, input().split())
    res = res.intersection(a)
print(len(res))