n, m = map(int, input().split())
counter_map = [0] * (m + 1)

for i in range(n):
    k, *a = map(int, input().split())
    for j in a:
        counter_map[j] += 1

res = 0
for i in range(m + 1):
    if counter_map[i] == n:
        res += 1

print(res) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m counter_map = [0] * (m + 1) counter_map [0] * (m + 1) [0] 0 m + 1 m 1 for i in range(n):
    k, *a = map(int, input().split())
    for j in a:
        counter_map[j] += 1 i range(n) range n k, *a = map(int, input().split()) k map(int, input().split()) map int input().split() ().split () input split *a a for j in a:
        counter_map[j] += 1 j a counter_map[j] += 1 counter_map[j] counter_map j 1 res = 0 res 0 for i in range(m + 1):
    if counter_map[i] == n:
        res += 1 i range(m + 1) range m + 1 m 1 if counter_map[i] == n:
        res += 1 counter_map[i] == n counter_map[i] counter_map i n res += 1 res 1 print(res) print res k, *a = map(int, input().split()) map(int, input().split()) k counter_map = [0] * (m + 1) [0] * (m + 1) counter_map n, m = map(int, input().split()) map(int, input().split()) n res += 1 1 res res = 0 0 res m = map(int, input().split()) map(int, input().split()) m
n, m = map(int, input().split())
counter_map = [0] * (m + 1)

for i in range(n):
    k, *a = map(int, input().split())
    for j in a:
        counter_map[j] += 1

res = 0
for i in range(m + 1):
    if counter_map[i] == n:
        res += 1

print(res)