#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

bool dfs(int v, vector<vector<int> > &adj, vector<int> &col){
    for(int next : adj[v]){
        if(col[next] == col[v]) return false;
        if(col[next] == 0){
            col[next] = 3-col[v];
            if(!dfs(next, adj, col)){
                return false;
            }
        }
    }
    return true;
}

bool bipartite_coloring(vector<vector<int> > &adj, vector<int> &col){
    for(int i=0; i<(int)adj.size(); i++){
        if(col[i] == 0) col[i] = 1;
        if(!dfs(i, adj, col)){
            return false;
        }
    }
    return true;
}

int main(){
    while(1){
        int n,m;
        cin >> n >> m;
        if(n == 0) break;

        vector<vector<int> > adj(n);
        for(int i=0; i<m; i++){
            int s,t;
            cin >> s >> t;
            s--; t--;
            adj[s].push_back(t);
            adj[t].push_back(s);
        }
        vector<int> color(n, 0);
        if(!bipartite_coloring(adj, color)){
            cout << 0 << endl;
            continue;
        }
        int count=0;
        for(int i=0; i<n; i++){
            if(color[i] == 1) count++;
        }
        if(count > n-count){
            count = n-count;
        }
        
        int k=0;
        int ans[2];
        for(int d=0; d<2; d++){
            if(count%2 == 0){
                ans[k] = count/2;
                k++;
            }
            count = n-count;
        }
        if(k==2 && ans[0] == ans[1]){
            k--;
        }
        cout << k << endl;
        for(int i=0; i<k; i++){
            cout << ans[i] << endl;
        }
    }
    return 0;
}

