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

dic = {}

for i in range(N):
  for j in range(len(KA[i])-1):
    if KA[i][1+j] not in dic.keys():
      dic[KA[i][1+j]] = 1
    else:
      dic[KA[i][1+j]] += 1
      
ans = 0

for i in dic:
  if dic[i] == N:
    ans += 1
    
print(ans) N, M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M list(map(int,input().split())) for i in range(N) for i in range(N) i range(N) range N for i in range(N) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split KA = [list(map(int,input().split())) for i in range(N)] KA [list(map(int,input().split())) for i in range(N)] dic = {} dic {} for i in range(N):
  for j in range(len(KA[i])-1):
    if KA[i][1+j] not in dic.keys():
      dic[KA[i][1+j]] = 1
    else:
      dic[KA[i][1+j]] += 1
       i range(N) range N for j in range(len(KA[i])-1):
    if KA[i][1+j] not in dic.keys():
      dic[KA[i][1+j]] = 1
    else:
      dic[KA[i][1+j]] += 1
       j range(len(KA[i])-1) range len(KA[i])-1 len(KA[i]) len KA[i] KA i 1 if KA[i][1+j] not in dic.keys():
      dic[KA[i][1+j]] = 1
    else:
      dic[KA[i][1+j]] += 1
       KA[i][1+j] not in dic.keys() KA[i][1+j] [i] KA i 1+j 1 j dic.keys() dic.keys dic keys dic[KA[i][1+j]] = 1 dic[KA[i][1+j]] dic KA[i][1+j] [i] KA i 1+j 1 j 1 dic[KA[i][1+j]] += 1 dic[KA[i][1+j]] dic KA[i][1+j] [i] KA i 1+j 1 j 1 ans = 0 ans 0 for i in dic:
  if dic[i] == N:
    ans += 1
     i dic if dic[i] == N:
    ans += 1
     dic[i] == N dic[i] dic i N ans += 1 ans 1 print(ans) print ans dic = {} {} dic ans = 0 0 ans KA = [list(map(int,input().split())) for i in range(N)] [list(map(int,input().split())) for i in range(N)] KA ans += 1 1 ans N, M = map(int,input().split()) map(int,input().split()) N M = map(int,input().split()) map(int,input().split()) M
N, M = map(int,input().split())
KA = [list(map(int,input().split())) for i in range(N)]

dic = {}

for i in range(N):
  for j in range(len(KA[i])-1):
    if KA[i][1+j] not in dic.keys():
      dic[KA[i][1+j]] = 1
    else:
      dic[KA[i][1+j]] += 1
      
ans = 0

for i in dic:
  if dic[i] == N:
    ans += 1
    
print(ans)