N, M = map(int, input().split())
L = []
for i in range(N):
  L.append(list(map(int, input().split())))

S = [0]*M

for j in range (N):
  for k in range(1, L[j][0]+1):
    S[L[j][k]-1] += 1
    
print(S.count(N)) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M L = [] L [] for i in range(N):
  L.append(list(map(int, input().split()))) i range(N) range N L.append(list(map(int, input().split()))) L.append L append list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split S = [0]*M S [0]*M [0] 0 M for j in range (N):
  for k in range(1, L[j][0]+1):
    S[L[j][k]-1] += 1
     j range (N) range N for k in range(1, L[j][0]+1):
    S[L[j][k]-1] += 1
     k range(1, L[j][0]+1) range 1 L[j][0]+1 L[j][0] [j] L j 0 1 S[L[j][k]-1] += 1 S[L[j][k]-1] S L[j][k]-1 L[j][k] [j] L j k 1 1 print(S.count(N)) print S.count(N) S.count S count N N, M = map(int, input().split()) map(int, input().split()) N M = map(int, input().split()) map(int, input().split()) M L = [] [] L S = [0]*M [0]*M S
N, M = map(int, input().split())
L = []
for i in range(N):
  L.append(list(map(int, input().split())))

S = [0]*M

for j in range (N):
  for k in range(1, L[j][0]+1):
    S[L[j][k]-1] += 1
    
print(S.count(N))