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