N,M,*S = $<.read.split.map &:to_i
A = [[]]*(N+1)
M.times {|i|
  s = S[i+i,2]
  x,y = s.map {|i;j| i=j while (j=A[i]).frozen?; i}.sort
  a,b = [A[x],A[y]].map{_1[0] ? _1 : []}.sort_by{_1.size}
  a.concat(b).push(*s)
  s.each {|i;j| A[i],i = y,j while (j=A[i]).frozen?; A[i]=y; A[y]=a}
}
p A.map{_1.frozen? ? 0 : _1.uniq.size}.max