require 'set'
while 1
    n, m = gets.split.map(&:to_i)
    break if n == 0 && m == 0
    g = {}
    (1..n).each {|i| g[i] = []}
    m.times do
        i, j = gets.split.map(&:to_i)
        g[i] << j
        g[j] << i
    end
    color = { 1 => 0 }
    queue = [1]
    until queue.empty?
        i = queue.shift
        c = color[i]
        g[i].each do |j|
            if color[j] && color[j] != 1 - c
                queue = []
                color = nil
                break
            elsif !color[j]
                color[j] = 1 - c
                queue << j
            end
        end
    end
    ans = Set.new
    if color
        k = color.values.count(0)
        if k.even?
            ans << k / 2
        end
        if (n - k).even?
            ans << (n - k) / 2
        end
    end
    p ans.size
    puts ans.sort
end

