n, m = map(int, input().split())
like = [0]*m

for _ in range(n):
    al = list(map(int, input().split()))
    arr = al[1:]
    for a in arr:
        like[a-1] += 1

print(like.count(n)) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m like = [0]*m like [0]*m [0] 0 m for _ in range(n):
    al = list(map(int, input().split()))
    arr = al[1:]
    for a in arr:
        like[a-1] += 1 _ range(n) range n al = list(map(int, input().split())) al list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split arr = al[1:] arr al[1:] al 1: 1 for a in arr:
        like[a-1] += 1 a arr like[a-1] += 1 like[a-1] like a-1 a 1 1 print(like.count(n)) print like.count(n) like.count like count n n, m = map(int, input().split()) map(int, input().split()) n al = list(map(int, input().split())) list(map(int, input().split())) al like = [0]*m [0]*m like arr = al[1:] al[1:] arr m = map(int, input().split()) map(int, input().split()) m
n, m = map(int, input().split())
like = [0]*m

for _ in range(n):
    al = list(map(int, input().split()))
    arr = al[1:]
    for a in arr:
        like[a-1] += 1

print(like.count(n))
