N,M,*S = $<.read.split.map &:to_i
A = [p]*(N+1)
M.times {|i|
  a,b = s = S[i+i,2].sort!
  x,y = s.map {|i;j| i=j while (j=A[i]) && j[0]; i}.sort
  next  if x==y
  if h = A[y]
    if z = A[x]
      if z.size > h.size
        h = z.merge h
      else
        h.merge z
      end
    end       
  else
    h = A[x] || {}
  end
  h[a] = h[b] = 0
  s.each {|i;j| A[i],i = y,j while (j=A[i]) && j[0]; i }
  A[a] = A[b] = y
  A[y] = h
}
p (1..N).map{a=A[_1]||0; a[0] ? 0 : a.size}.max 