import numpy as np

n, m = map(int, input().split())
res = np.ones(m, dtype=np.int8)
for _ in range(n):
    a_like = np.zeros_like(res)
    for a in map(lambda x: int(x)-1, input()[2:].split()):
        a_like[a] = 1
    res *= a_like
print(np.count_nonzero(res)) import numpy as np numpy n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m res = np.ones(m, dtype=np.int8) res np.ones(m, dtype=np.int8) np.ones np ones m dtype=np.int8 dtype np.int8 np int8 for _ in range(n):
    a_like = np.zeros_like(res)
    for a in map(lambda x: int(x)-1, input()[2:].split()):
        a_like[a] = 1
    res *= a_like _ range(n) range n a_like = np.zeros_like(res) a_like np.zeros_like(res) np.zeros_like np zeros_like res for a in map(lambda x: int(x)-1, input()[2:].split()):
        a_like[a] = 1
     a map(lambda x: int(x)-1, input()[2:].split()) map lambda x: int(x)-1 int(x)-1 int(x) int x 1 x input()[2:].split() [2:].split [2:] () input 2: 2 split a_like[a] = 1 a_like[a] a_like a 1 res *= a_like res a_like print(np.count_nonzero(res)) print np.count_nonzero(res) np.count_nonzero np count_nonzero res n, m = map(int, input().split()) map(int, input().split()) n a_like = np.zeros_like(res) np.zeros_like(res) a_like res *= a_like a_like res res = np.ones(m, dtype=np.int8) np.ones(m, dtype=np.int8) res m = map(int, input().split()) map(int, input().split()) m
import numpy as np

n, m = map(int, input().split())
res = np.ones(m, dtype=np.int8)
for _ in range(n):
    a_like = np.zeros_like(res)
    for a in map(lambda x: int(x)-1, input()[2:].split()):
        a_like[a] = 1
    res *= a_like
print(np.count_nonzero(res))
