n, m = map(int, input().split())
d = [0] * m

for i in range(n):
    k, *a = list(map(int, input().split()))
    for num in a:
        d[num-1] += 1

c = 0
for num in d:
    if num == n:
        c += 1
print(c) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m d = [0] * m d [0] * m [0] 0 m for i in range(n):
    k, *a = list(map(int, input().split()))
    for num in a:
        d[num-1] += 1 i range(n) range n k, *a = list(map(int, input().split())) k list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split *a a for num in a:
        d[num-1] += 1 num a d[num-1] += 1 d[num-1] d num-1 num 1 1 c = 0 c 0 for num in d:
    if num == n:
        c += 1 num d if num == n:
        c += 1 num == n num n c += 1 c 1 print(c) print c d = [0] * m [0] * m d n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m k, *a = list(map(int, input().split())) list(map(int, input().split())) k c = 0 0 c c += 1 1 c
n, m = map(int, input().split())
d = [0] * m

for i in range(n):
    k, *a = list(map(int, input().split()))
    for num in a:
        d[num-1] += 1

c = 0
for num in d:
    if num == n:
        c += 1
print(c)