N,M = map(int,list(input().split()))
i_list = [0]*M
for i in range(N):
    s = list(input().split())
    for j in range(int(s[0])):
        i_list[int(s[j+1])-1] += 1
     #   print(i_list)
counter = 0
for i in range(M):
    if i_list[i] == N:
        counter += 1   
    
print(counter) N,M = map(int,list(input().split())) N map(int,list(input().split())) map int list(input().split()) list input().split() ().split () input split M i_list = [0]*M i_list [0]*M [0] 0 M for i in range(N):
    s = list(input().split())
    for j in range(int(s[0])):
        i_list[int(s[j+1])-1] += 1
     #   print(i_list) i range(N) range N s = list(input().split()) s list(input().split()) list input().split() ().split () input split for j in range(int(s[0])):
        i_list[int(s[j+1])-1] += 1
     #   print(i_list) j range(int(s[0])) range int(s[0]) int s[0] s 0 i_list[int(s[j+1])-1] += 1 i_list[int(s[j+1])-1] i_list int(s[j+1])-1 int(s[j+1]) int s[j+1] s j+1 j 1 1 1 counter = 0 counter 0 for i in range(M):
    if i_list[i] == N:
        counter += 1   
     i range(M) range M if i_list[i] == N:
        counter += 1   
     i_list[i] == N i_list[i] i_list i N counter += 1 counter 1 print(counter) print counter i_list = [0]*M [0]*M i_list M = map(int,list(input().split())) map(int,list(input().split())) M counter += 1 1 counter N,M = map(int,list(input().split())) map(int,list(input().split())) N s = list(input().split()) list(input().split()) s counter = 0 0 counter
N,M = map(int,list(input().split()))
i_list = [0]*M
for i in range(N):
    s = list(input().split())
    for j in range(int(s[0])):
        i_list[int(s[j+1])-1] += 1
     #   print(i_list)
counter = 0
for i in range(M):
    if i_list[i] == N:
        counter += 1   
    
print(counter)
