#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    while (1)
    {
        int n, m;
        cin >> n >> m;
        if (n == 0)
            break;
        vector<int> G[1010];
        rep(i, m)
        {
            int u, v;
            cin >> u >> v;
            u--, v--;
            G[u].push_back(v);
            G[v].push_back(u);
        }
        vector<int> col(n, 0); //B -> 1, W -> 2, ? -> 0
        col[0] = 1;
        queue<int> que;
        que.push(0);
        bool che = true;
        while (!que.empty())
        {
            int now = que.front();
            que.pop();
            int nxt_col = 3 - col[now];
            rep(i, G[now].size())
            {
                if (col[G[now][i]] != 0)
                {
                    if (col[G[now][i]] != nxt_col)
                        che = false;
                    continue;
                }
                col[G[now][i]] = nxt_col;
                que.push(G[now][i]);
            }
        }
        if (!che)
        {
            cout << 0 << endl;
            continue;
        }
        int num_B = 0;
        rep(i, n) if (col[i] == 1) num_B++;
        int num_W = n - num_B;
        int ans = 0;
        if (num_B % 2 == 0)
            ans++;
        if (num_W % 2 == 0)
            ans++;
        if (num_B == num_W && ans != 0)
            ans--;
        cout << ans << endl;
        if (ans == 2)
            cout << min(num_B / 2, num_W / 2) << endl
                 << max(num_B / 2, num_W / 2) << endl;
        else if (ans == 1)
        {
            if (num_B % 2 == 0)
                cout << num_B / 2 << endl;
            else
                cout << num_W / 2 << endl;
        }
    }
}

