N,M = list(map(int,input().split()))
KA = []
for i in range(N):
    KA.append(list(map(int,input().split())))

food = [0 for i in range(M)]

for i in range(N):
    x = KA[i][1:]
    for j in x:
        food[j - 1] += 1

print(food.count(N)) 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 KA = [] KA [] for i in range(N):
    KA.append(list(map(int,input().split()))) i range(N) range N KA.append(list(map(int,input().split()))) KA.append KA append list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split 0 for i in range(M) for i in range(M) i range(M) range M for i in range(M) 0 food = [0 for i in range(M)] food [0 for i in range(M)] for i in range(N):
    x = KA[i][1:]
    for j in x:
        food[j - 1] += 1 i range(N) range N x = KA[i][1:] x KA[i][1:] [i] KA i 1: 1 for j in x:
        food[j - 1] += 1 j x food[j - 1] += 1 food[j - 1] food j - 1 j 1 1 print(food.count(N)) print food.count(N) food.count food count N KA = [] [] KA M = list(map(int,input().split())) list(map(int,input().split())) M x = KA[i][1:] KA[i][1:] x N,M = list(map(int,input().split())) list(map(int,input().split())) N food = [0 for i in range(M)] [0 for i in range(M)] food
N,M = list(map(int,input().split()))
KA = []
for i in range(N):
    KA.append(list(map(int,input().split())))

food = [0 for i in range(M)]

for i in range(N):
    x = KA[i][1:]
    for j in x:
        food[j - 1] += 1

print(food.count(N))