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