# その23
# ABC118 B - Foods Loved by Everyone

n,m = map(int,input().split())
K_2=[]
t = 0
for i in range(n):
    A, *K =list(map(int,input().split()))
    K_2 +=K
K_3 = list(set(K_2))
for j in range(len(K_3)):
    K_4 = K_2.count(K_3[j])
    if K_4 == n:
        t +=1
print(t) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m K_2=[] K_2 [] t = 0 t 0 for i in range(n):
    A, *K =list(map(int,input().split()))
    K_2 +=K i range(n) range n A, *K =list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split *K K K_2 +=K K_2 K K_3 = list(set(K_2)) K_3 list(set(K_2)) list set(K_2) set K_2 for j in range(len(K_3)):
    K_4 = K_2.count(K_3[j])
    if K_4 == n:
        t +=1 j range(len(K_3)) range len(K_3) len K_3 K_4 = K_2.count(K_3[j]) K_4 K_2.count(K_3[j]) K_2.count K_2 count K_3[j] K_3 j if K_4 == n:
        t +=1 K_4 == n K_4 n t +=1 t 1 print(t) print t t +=1 1 t t = 0 0 t K_2 +=K K K_2 K_4 = K_2.count(K_3[j]) K_2.count(K_3[j]) K_4 n,m = map(int,input().split()) map(int,input().split()) n K_2=[] [] K_2 K_3 = list(set(K_2)) list(set(K_2)) K_3 A, *K =list(map(int,input().split())) list(map(int,input().split())) A m = map(int,input().split()) map(int,input().split()) m
# その23
# ABC118 B - Foods Loved by Everyone

n,m = map(int,input().split())
K_2=[]
t = 0
for i in range(n):
    A, *K =list(map(int,input().split()))
    K_2 +=K
K_3 = list(set(K_2))
for j in range(len(K_3)):
    K_4 = K_2.count(K_3[j])
    if K_4 == n:
        t +=1
print(t)