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

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

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

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

print(sum(i==n for i in like))
