n, m = map(int, input().split())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
l = [0] * m
for i in range(n):
    for j in range(m):
        if j + 1 in a[i][1:]:
            l[j] += 1
count = 0
for i in range(m):
    if l[i] == n:
        count += 1
print(count) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m a = [] a [] for i in range(n):
    a.append(list(map(int, input().split()))) i range(n) range n a.append(list(map(int, input().split()))) a.append a append list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split l = [0] * m l [0] * m [0] 0 m for i in range(n):
    for j in range(m):
        if j + 1 in a[i][1:]:
            l[j] += 1 i range(n) range n for j in range(m):
        if j + 1 in a[i][1:]:
            l[j] += 1 j range(m) range m if j + 1 in a[i][1:]:
            l[j] += 1 j + 1 in a[i][1:] j + 1 j 1 a[i][1:] [i] a i 1: 1 l[j] += 1 l[j] l j 1 count = 0 count 0 for i in range(m):
    if l[i] == n:
        count += 1 i range(m) range m if l[i] == n:
        count += 1 l[i] == n l[i] l i n count += 1 count 1 print(count) print count a = [] [] a m = map(int, input().split()) map(int, input().split()) m l = [0] * m [0] * m l count = 0 0 count count += 1 1 count n, m = map(int, input().split()) map(int, input().split()) n
n, m = map(int, input().split())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
l = [0] * m
for i in range(n):
    for j in range(m):
        if j + 1 in a[i][1:]:
            l[j] += 1
count = 0
for i in range(m):
    if l[i] == n:
        count += 1
print(count)