# 辺の追加 def solve(i, u, k) return if i >= $r.length ur = u + $r[i] return if $memo[ur - 1] >= 0 $memo[ur - 1] = k solve(i + 1, u, k) solve(i + 1, ur, k + 1) end $n, m = gets.split.map(&:to_i) #n = 2 * 10 ** 5 #m = 2 * 10 ** 5 a = Hash.new{|h, k| h[k] = Array.new} b = Array.new($n, false) #n.times do |i| # a[2 * i + 1].push(2 * i + 2) # a[2 * i + 2].push(2 * i + 1) #end m.times do |i| s = gets.split.map(&:to_i) next if s[0] == s[1] a[s[0]].push(s[1]) a[s[1]].push(s[0]) end $r = Array.new $memo = Array.new($n, -1) stack = Array.new(m + 10) $n.times do |i| i += 1 next if b[i] top = 1 bottom = 0 stack[0] = i count = 1 while bottom < top do j = stack[top - 1] if !a.has_key?(j) top -= 1 next end b[j] = true a[j].each do |x| next if b[x] b[x] = true stack[top] = x top += 1 count += 1 end bottom += 1 end $r.push(count) end $r.sort!{|a, b| b <=> a} solve(0, 0, 0) puts $memo