#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a*b/gcd(a,b);
}

class Bipartite{
private:
    vector<vi> g;
    bool c; //is bipartite graph
    int n;
    vector<int> used;
    int cnt[2];
    vector<pii> p;

    void dfs(int now){
        cnt[used[now]]++;
        rep(i,g[now].size()){
            int ne = g[now][i];
            if(used[ne] == -1){
                used[ne] = 1 - used[now];
                dfs(ne);
            }else if(used[ne] == used[now]){
                c = false;
                return;
            }
        }
    }

public:
    Bipartite(){};
    Bipartite(int size){
        n = size;
        g = vector<vector<int> > (size);
        used = vector<int> (size);
    }

    void add(int a,int b){//無向辺を追加
        g[a].push_back(b);
        g[b].push_back(a);//有向辺の場合はここをコメントアウト
    }

    bool is_bipartite(){//二部グラフ判定
        p.clear();
        c = true;
        rep(i,n) used[i] = -1;
        rep(i,n)if(used[i]==-1){
            used[i] = 0;
            cnt[0] = cnt[1] = 0;
            dfs(i);
            if(c==false) return false;
            p.push_back(pii(cnt[0],cnt[1]));
        }

        return true;
    }

    vector<int> split(){//2つにわけるときの分け方
        vector<int> ret;
        if(is_bipartite() == false)return ret;
        int N = p.size();
        set<int> st;
        st.insert(0);
        rep(i,N){
            set<int> nst;
            for(set<int>::iterator itr = st.begin(); itr != st.end(); ++itr){
                nst.insert(*itr + p[i].first);
                nst.insert(*itr + p[i].second);
            }
            st = nst;
        }
        for(set<int>::iterator itr = st.begin(); itr != st.end(); ++itr) ret.push_back(*itr);
        return ret;
    }

};

signed main(void) {
    int i,j;
    int n,m;
    while(cin >> n >> m, n){
        Bipartite bi(n);
        rep(i,m){
            int a,b;
            cin >> a >> b;
            bi.add(a-1,b-1);
        }
        vi p = bi.split(),ans;
        rep(i,p.size())if(p[i] % 2 == 0)ans.push_back(p[i]/2);
        sort(all(ans));
        cout << ans.size() << endl;
        rep(i,ans.size())cout << ans[i] << endl;
    }
}

