n, m = map(int, input().split())
ansers = [list(map(int, input().split())) for _ in range(n)]
foods = [0] * (m + 1)

for i in range(n):
    for j in range(1, len(ansers[i])):
        foods[ansers[i][j]] += 1

print(foods.count(n)) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m list(map(int, input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ansers = [list(map(int, input().split())) for _ in range(n)] ansers [list(map(int, input().split())) for _ in range(n)] foods = [0] * (m + 1) foods [0] * (m + 1) [0] 0 m + 1 m 1 for i in range(n):
    for j in range(1, len(ansers[i])):
        foods[ansers[i][j]] += 1 i range(n) range n for j in range(1, len(ansers[i])):
        foods[ansers[i][j]] += 1 j range(1, len(ansers[i])) range 1 len(ansers[i]) len ansers[i] ansers i foods[ansers[i][j]] += 1 foods[ansers[i][j]] foods ansers[i][j] [i] ansers i j 1 print(foods.count(n)) print foods.count(n) foods.count foods count n n, m = map(int, input().split()) map(int, input().split()) n ansers = [list(map(int, input().split())) for _ in range(n)] [list(map(int, input().split())) for _ in range(n)] ansers foods = [0] * (m + 1) [0] * (m + 1) foods m = map(int, input().split()) map(int, input().split()) m
n, m = map(int, input().split())
ansers = [list(map(int, input().split())) for _ in range(n)]
foods = [0] * (m + 1)

for i in range(n):
    for j in range(1, len(ansers[i])):
        foods[ansers[i][j]] += 1

print(foods.count(n))
