n,m = map(int, input().split())
x = [0] * m
for _ in range(n):
    a = list(map(int, input().split()))[1:]
    for ai in a:
        x[ai-1] += 1
ans = len([1 for i in range(m) if x[i] == n])
print(ans) n,m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m x = [0] * m x [0] * m [0] 0 m for _ in range(n):
    a = list(map(int, input().split()))[1:]
    for ai in a:
        x[ai-1] += 1 _ 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 for ai in a:
        x[ai-1] += 1 ai a x[ai-1] += 1 x[ai-1] x ai-1 ai 1 1 1 for i in range(m) if x[i] == n for i in range(m) if x[i] == n i range(m) range m x[i] == n x[i] x i n if x[i] == n 1 ans = len([1 for i in range(m) if x[i] == n]) ans len([1 for i in range(m) if x[i] == n]) len [1 for i in range(m) if x[i] == n] print(ans) print ans n,m = map(int, input().split()) map(int, input().split()) n x = [0] * m [0] * m x m = map(int, input().split()) map(int, input().split()) m a = list(map(int, input().split()))[1:] list(map(int, input().split()))[1:] a ans = len([1 for i in range(m) if x[i] == n]) len([1 for i in range(m) if x[i] == n]) ans
n,m = map(int, input().split())
x = [0] * m
for _ in range(n):
    a = list(map(int, input().split()))[1:]
    for ai in a:
        x[ai-1] += 1
ans = len([1 for i in range(m) if x[i] == n])
print(ans)