N,M,*P = $<.read.split.map &:to_i
C = [m=1]*(N+1)
A = C.map {[]}
(0...M).map {|i| a=P[i+=i]; b=P[i+1]; a<b ? [a,b] : [b,a]}.sort.each{|a,b| A[a] << b}
1.upto(N) {|i|
  a = A[j=i]
  a.each {k = A[_1][-1]||_1; j<k && j=k}
  next  if j == i
  a.each {b=A[_1]; b << j  if b[-1]!=j}
  m < C[j]+=C[i] and m = C[j]
}
p m