n, m = map(int, input().split())
k = []
a = []
for _ in range(n):
    words = input().split()
    k.append(int(words[0]))
    a.append(list(map(int, words[1:])))

like_cnt = {i: 0 for i in range(1, m + 1)}
for ai in a:
    for aij in ai:
        like_cnt[aij] += 1
print(list(like_cnt.values()).count(n)) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m k = [] k [] a = [] a [] for _ in range(n):
    words = input().split()
    k.append(int(words[0]))
    a.append(list(map(int, words[1:]))) _ range(n) range n words = input().split() words input().split() ().split () input split k.append(int(words[0])) k.append k append int(words[0]) int words[0] words 0 a.append(list(map(int, words[1:]))) a.append a append list(map(int, words[1:])) list map(int, words[1:]) map int words[1:] words 1: 1 i: 0 for i in range(1, m + 1) for i in range(1, m + 1) i range(1, m + 1) range 1 m + 1 m 1 for i in range(1, m + 1) i 0 like_cnt = {i: 0 for i in range(1, m + 1)} like_cnt {i: 0 for i in range(1, m + 1)} for ai in a:
    for aij in ai:
        like_cnt[aij] += 1 ai a for aij in ai:
        like_cnt[aij] += 1 aij ai like_cnt[aij] += 1 like_cnt[aij] like_cnt aij 1 print(list(like_cnt.values()).count(n)) print list(like_cnt.values()).count(n) (like_cnt.values()).count (like_cnt.values()) list like_cnt.values() like_cnt.values like_cnt values count n m = map(int, input().split()) map(int, input().split()) m n, m = map(int, input().split()) map(int, input().split()) n a = [] [] a k = [] [] k words = input().split() input().split() words like_cnt = {i: 0 for i in range(1, m + 1)} {i: 0 for i in range(1, m + 1)} like_cnt
n, m = map(int, input().split())
k = []
a = []
for _ in range(n):
    words = input().split()
    k.append(int(words[0]))
    a.append(list(map(int, words[1:])))

like_cnt = {i: 0 for i in range(1, m + 1)}
for ai in a:
    for aij in ai:
        like_cnt[aij] += 1
print(list(like_cnt.values()).count(n))
