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

cnt = [0] * m
for i in range(n):
    k, *a = map(int, input().split())
    for a_ in a:
        cnt[a_ - 1] += 1
        
print(sum(c == n for c in cnt)) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m cnt = [0] * m cnt [0] * m [0] 0 m for i in range(n):
    k, *a = map(int, input().split())
    for a_ in a:
        cnt[a_ - 1] += 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 a_ in a:
        cnt[a_ - 1] += 1
         a_ a cnt[a_ - 1] += 1 cnt[a_ - 1] cnt a_ - 1 a_ 1 1 print(sum(c == n for c in cnt)) print sum(c == n for c in cnt) sum c == n c n cnt = [0] * m [0] * m cnt k, *a = map(int, input().split()) map(int, input().split()) k n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m
n, m = map(int, input().split())

cnt = [0] * m
for i in range(n):
    k, *a = map(int, input().split())
    for a_ in a:
        cnt[a_ - 1] += 1
        
print(sum(c == n for c in cnt))