n, m = map(int, input().split())
response_list = []
for _ in range(n):
    response = list(map(int, input().split()))
    response.pop(0)
    response_list.append(response)

cnt_list = [0]*m
for list in response_list:
    for i in list:
        cnt_list[i-1] += 1

ans = 0
for j in cnt_list:
    if j == n:
        ans += 1

print(ans) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m response_list = [] response_list [] for _ in range(n):
    response = list(map(int, input().split()))
    response.pop(0)
    response_list.append(response) _ range(n) range n response = list(map(int, input().split())) response list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split response.pop(0) response.pop response pop 0 response_list.append(response) response_list.append response_list append response cnt_list = [0]*m cnt_list [0]*m [0] 0 m for list in response_list:
    for i in list:
        cnt_list[i-1] += 1 list response_list for i in list:
        cnt_list[i-1] += 1 i list cnt_list[i-1] += 1 cnt_list[i-1] cnt_list i-1 i 1 1 ans = 0 ans 0 for j in cnt_list:
    if j == n:
        ans += 1 j cnt_list if j == n:
        ans += 1 j == n j n ans += 1 ans 1 print(ans) print ans n, m = map(int, input().split()) map(int, input().split()) n ans = 0 0 ans m = map(int, input().split()) map(int, input().split()) m ans += 1 1 ans response = list(map(int, input().split())) list(map(int, input().split())) response cnt_list = [0]*m [0]*m cnt_list response_list = [] [] response_list
n, m = map(int, input().split())
response_list = []
for _ in range(n):
    response = list(map(int, input().split()))
    response.pop(0)
    response_list.append(response)

cnt_list = [0]*m
for list in response_list:
    for i in list:
        cnt_list[i-1] += 1

ans = 0
for j in cnt_list:
    if j == n:
        ans += 1

print(ans)