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

like = [True] * (m+1)

for i in range(n):
    ka = list(map(int, input().split()))
    for j in range(1, m+1):
        if j not in ka[1:]:
            like[j] = False

print(like[1:].count(True))
         n, m = list(map(int, input().split())) n list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split m like = [True] * (m+1) like [True] * (m+1) [True] True m+1 m 1 for i in range(n):
    ka = list(map(int, input().split()))
    for j in range(1, m+1):
        if j not in ka[1:]:
            like[j] = False i range(n) range n ka = list(map(int, input().split())) ka list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for j in range(1, m+1):
        if j not in ka[1:]:
            like[j] = False j range(1, m+1) range 1 m+1 m 1 if j not in ka[1:]:
            like[j] = False j not in ka[1:] j ka[1:] ka 1: 1 like[j] = False like[j] like j False print(like[1:].count(True)) print like[1:].count(True) [1:].count [1:] like 1: 1 count True like = [True] * (m+1) [True] * (m+1) like m = list(map(int, input().split())) list(map(int, input().split())) m n, m = list(map(int, input().split())) list(map(int, input().split())) n ka = list(map(int, input().split())) list(map(int, input().split())) ka
n, m = list(map(int, input().split()))

like = [True] * (m+1)

for i in range(n):
    ka = list(map(int, input().split()))
    for j in range(1, m+1):
        if j not in ka[1:]:
            like[j] = False

print(like[1:].count(True))
        
