N, M = map(int, input().split())
dic = {i :0 for i in range(1, M+1)}

for j in range(N):
    lis = list(map(int, input().split()))
    count = lis[0]
    answer = lis[1:]
    for k in answer:
        dic[k] += 1

num = [x for x in dic.values() if x == N]
print(len(num))
 N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M 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 dic = {i :0 for i in range(1, M+1)} dic {i :0 for i in range(1, M+1)} for j in range(N):
    lis = list(map(int, input().split()))
    count = lis[0]
    answer = lis[1:]
    for k in answer:
        dic[k] += 1 j range(N) range N lis = list(map(int, input().split())) lis list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split count = lis[0] count lis[0] lis 0 answer = lis[1:] answer lis[1:] lis 1: 1 for k in answer:
        dic[k] += 1 k answer dic[k] += 1 dic[k] dic k 1 x for x in dic.values() if x == N for x in dic.values() if x == N x dic.values() dic.values dic values x == N x N if x == N x num = [x for x in dic.values() if x == N] num [x for x in dic.values() if x == N] print(len(num)) print len(num) len num answer = lis[1:] lis[1:] answer M = map(int, input().split()) map(int, input().split()) M num = [x for x in dic.values() if x == N] [x for x in dic.values() if x == N] num lis = list(map(int, input().split())) list(map(int, input().split())) lis dic = {i :0 for i in range(1, M+1)} {i :0 for i in range(1, M+1)} dic count = lis[0] lis[0] count N, M = map(int, input().split()) map(int, input().split()) N
N, M = map(int, input().split())
dic = {i :0 for i in range(1, M+1)}

for j in range(N):
    lis = list(map(int, input().split()))
    count = lis[0]
    answer = lis[1:]
    for k in answer:
        dic[k] += 1

num = [x for x in dic.values() if x == N]
print(len(num))

