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

for i in range(n):
    a = list(map(int, input().split()))
    for j in range(a[0]):
        d[a[j+1]-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):
    a = list(map(int, input().split()))
    for j in range(a[0]):
        d[a[j+1]-1] += 1 i range(n) range n a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for j in range(a[0]):
        d[a[j+1]-1] += 1 j range(a[0]) range a[0] a 0 d[a[j+1]-1] += 1 d[a[j+1]-1] d a[j+1]-1 a[j+1] a j+1 j 1 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 n, m = map(int, input().split()) map(int, input().split()) n a = list(map(int, input().split())) list(map(int, input().split())) a c += 1 1 c m = map(int, input().split()) map(int, input().split()) m d = [0] * m [0] * m d c = 0 0 c
n, m = map(int, input().split())
d = [0] * m

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

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