#include<bits/stdc++.h>
using namespace std;

void dfs(int node, vector<int> &color, vector<vector<int> > &g, int c){
    color[node] = c;
    int nextcolor = (c == 1) ? 2 : 1;
    for(int i = 0; i < g[node].size(); i++){

        int nextnode = g[node][i];
       //未訪問なら
       if(color[nextnode] == 0){
           dfs(nextnode, color, g, nextcolor);
       }else if(color[nextnode] == c){
           color[node] = 3;
           return;
       }
    }
    return;
    
}

int main(){

    while(1){
        int n, m; cin >> n >> m;
        if(!n)break;
    
        vector<vector<int> > g(n);
        for(int i = 0; i < m; i++){
            int a, b; cin >> a >> b; a--; b--;
            g[a].push_back(b);
            g[b].push_back(a);
        }
        vector<int> color(n, 0);
        dfs(0, color, g, 1);
        int cnt = 0;
        for(int i = 0; i < n; i++){
            if(color[i] == 1) cnt++;
            else if(color[i] == 3){
                cnt = -10000000;
            }
        }

        if(cnt <= 0) cout << 0 << endl;
        else{
            int cnt2 = n - cnt;
            vector<int> ans;
            if(cnt % 2 == 0) ans.push_back(cnt / 2);
            if(cnt2 % 2 == 0) ans.push_back(cnt2 / 2);
            
            sort(ans.begin(), ans.end());
            ans.erase(unique(ans.begin(), ans.end()), ans.end());
            

            cout << ans.size() << endl;            
            for(int i = 0; i < ans.size(); i++){
                cout << ans[i] << endl;
            }
                        
        }
    }
    return 0;
}
