N,M=map(int,input().split())
ka=[[int(x) for x in input().split()] for _ in range(N)]
K=list()
A=list()
for i in range(N):
  K.append(ka[i][0])
  A.append(ka[i][1:])
ans=[0]*(M+1)
for i in range(N):
  for j in range(K[i]):
    ans[A[i][j]]+=1
cnt=0
for i in range(M+1):
  if ans[i]==N:
    cnt+=1
print(cnt) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M [int(x) for x in input().split()] for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) [int(x) for x in input().split()] ka=[[int(x) for x in input().split()] for _ in range(N)] ka [[int(x) for x in input().split()] for _ in range(N)] K=list() K list() list A=list() A list() list for i in range(N):
  K.append(ka[i][0])
  A.append(ka[i][1:]) i range(N) range N K.append(ka[i][0]) K.append K append ka[i][0] [i] ka i 0 A.append(ka[i][1:]) A.append A append ka[i][1:] [i] ka i 1: 1 ans=[0]*(M+1) ans [0]*(M+1) [0] 0 M+1 M 1 for i in range(N):
  for j in range(K[i]):
    ans[A[i][j]]+=1 i range(N) range N for j in range(K[i]):
    ans[A[i][j]]+=1 j range(K[i]) range K[i] K i ans[A[i][j]]+=1 ans[A[i][j]] ans A[i][j] [i] A i j 1 cnt=0 cnt 0 for i in range(M+1):
  if ans[i]==N:
    cnt+=1 i range(M+1) range M+1 M 1 if ans[i]==N:
    cnt+=1 ans[i]==N ans[i] ans i N cnt+=1 cnt 1 print(cnt) print cnt ans=[0]*(M+1) [0]*(M+1) ans ka=[[int(x) for x in input().split()] for _ in range(N)] [[int(x) for x in input().split()] for _ in range(N)] ka M=map(int,input().split()) map(int,input().split()) M K=list() list() K cnt=0 0 cnt A=list() list() A cnt+=1 1 cnt N,M=map(int,input().split()) map(int,input().split()) N
N,M=map(int,input().split())
ka=[[int(x) for x in input().split()] for _ in range(N)]
K=list()
A=list()
for i in range(N):
  K.append(ka[i][0])
  A.append(ka[i][1:])
ans=[0]*(M+1)
for i in range(N):
  for j in range(K[i]):
    ans[A[i][j]]+=1
cnt=0
for i in range(M+1):
  if ans[i]==N:
    cnt+=1
print(cnt)
