num,food_num = map(int,input().split())

food_dict = {}

for i in range(num):
    l = list(map(int,input().split()))
    for j in range(1,l[0]+1):
            food_dict.setdefault(l[j],0)
            food_dict[l[j]] += 1

ans = 0

for name, likes in food_dict.items():
    if likes == num:
        ans += 1

print(ans) num,food_num = map(int,input().split()) num map(int,input().split()) map int input().split() ().split () input split food_num food_dict = {} food_dict {} for i in range(num):
    l = list(map(int,input().split()))
    for j in range(1,l[0]+1):
            food_dict.setdefault(l[j],0)
            food_dict[l[j]] += 1 i range(num) range num l = list(map(int,input().split())) l list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for j in range(1,l[0]+1):
            food_dict.setdefault(l[j],0)
            food_dict[l[j]] += 1 j range(1,l[0]+1) range 1 l[0]+1 l[0] l 0 1 food_dict.setdefault(l[j],0) food_dict.setdefault food_dict setdefault l[j] l j 0 food_dict[l[j]] += 1 food_dict[l[j]] food_dict l[j] l j 1 ans = 0 ans 0 for name, likes in food_dict.items():
    if likes == num:
        ans += 1 name likes food_dict.items() food_dict.items food_dict items if likes == num:
        ans += 1 likes == num likes num ans += 1 ans 1 print(ans) print ans l = list(map(int,input().split())) list(map(int,input().split())) l ans = 0 0 ans food_dict = {} {} food_dict ans += 1 1 ans food_num = map(int,input().split()) map(int,input().split()) food_num num,food_num = map(int,input().split()) map(int,input().split()) num
num,food_num = map(int,input().split())

food_dict = {}

for i in range(num):
    l = list(map(int,input().split()))
    for j in range(1,l[0]+1):
            food_dict.setdefault(l[j],0)
            food_dict[l[j]] += 1

ans = 0

for name, likes in food_dict.items():
    if likes == num:
        ans += 1

print(ans)
