#!/usr/bin/env python3
(n, m), *a = [[*map(int, i.split())] for i in open(0)]
like = [0] * m
for i in a:
    for j in i[1:]:
        like[j - 1] += 1
print(sum(i == n for i in like)) [*map(int, i.split())] for i in open(0) for i in open(0) i open(0) open 0 for i in open(0) [*map(int, i.split())] *map(int, i.split()) map(int, i.split()) map int i.split() i.split i split (n, m), *a = [[*map(int, i.split())] for i in open(0)] (n, m) n m [[*map(int, i.split())] for i in open(0)] *a a like = [0] * m like [0] * m [0] 0 m for i in a:
    for j in i[1:]:
        like[j - 1] += 1 i a for j in i[1:]:
        like[j - 1] += 1 j i[1:] i 1: 1 like[j - 1] += 1 like[j - 1] like j - 1 j 1 1 print(sum(i == n for i in like)) print sum(i == n for i in like) sum i == n i n like = [0] * m [0] * m like
#!/usr/bin/env python3
(n, m), *a = [[*map(int, i.split())] for i in open(0)]
like = [0] * m
for i in a:
    for j in i[1:]:
        like[j - 1] += 1
print(sum(i == n for i in like))
