n, m = map(int, input().split())

a = []
b = list((0 for i in range(m)))

for i in range(n):
    a.append(list(map(int, input().split())))
    
for a_ in a:
    k = a_[0]
    for k_ in range(k):
        b[(a_[k_ + 1]) - 1] += 1
        
ans = 0
for b_ in b:
    if b_ == n:
        ans += 1
print(ans) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m a = [] a [] 0 for i in range(m) for i in range(m) i range(m) range m for i in range(m) 0 b = list((0 for i in range(m))) b list((0 for i in range(m))) list (0 for i in range(m)) 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 for a_ in a:
    k = a_[0]
    for k_ in range(k):
        b[(a_[k_ + 1]) - 1] += 1
         a_ a k = a_[0] k a_[0] a_ 0 for k_ in range(k):
        b[(a_[k_ + 1]) - 1] += 1
         k_ range(k) range k b[(a_[k_ + 1]) - 1] += 1 b[(a_[k_ + 1]) - 1] b (a_[k_ + 1]) - 1 a_[k_ + 1] a_ k_ + 1 k_ 1 1 1 ans = 0 ans 0 for b_ in b:
    if b_ == n:
        ans += 1 b_ b if b_ == n:
        ans += 1 b_ == n b_ n ans += 1 ans 1 print(ans) print ans k = a_[0] a_[0] k b = list((0 for i in range(m))) list((0 for i in range(m))) b ans += 1 1 ans ans = 0 0 ans m = map(int, input().split()) map(int, input().split()) m n, m = map(int, input().split()) map(int, input().split()) n a = [] [] a
n, m = map(int, input().split())

a = []
b = list((0 for i in range(m)))

for i in range(n):
    a.append(list(map(int, input().split())))
    
for a_ in a:
    k = a_[0]
    for k_ in range(k):
        b[(a_[k_ + 1]) - 1] += 1
        
ans = 0
for b_ in b:
    if b_ == n:
        ans += 1
print(ans)