N,M,*S = $<.read.split.map &:to_i
A = [[]]*(N+1)
M.times {|i|
  r,s = {},S[i+i,2]
  x,y = s.map {|i;j| r[i=j]=0 while (j=A[i])[0]; r[i]=i}.sort
  g,h = [A[x],A[y]].map{_1.empty? ? {} : _1}.sort_by{_1.size}
  h.merge!(g,s.to_h{[_1,0]})
  r.each {A[_1[0]] = y}
  A[y] = h
}
p A.map{_1[0] ? 1 : _1.size}.max