#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)

signed main() {
	for (int N, M; cin >> N >> M && N;) {
		vector<int> u(M), v(M);
		vector<vector<int>> G(N);
		rep(i, 0, M) {
			cin >> u[i] >> v[i];
			u[i]--, v[i]--;
			G[u[i]].push_back(v[i]);
			G[v[i]].push_back(u[i]);
		}

		vector<bool> vis(N);
		vector<bool> id(N);

		using State = tuple<bool, int, int>;
		queue<State> q;
		q.emplace(0, 0, -1);
		while (q.size()) {
			bool d; int v, p; tie(d, v, p) = q.front(); q.pop();
			vis[v] = true;
			for (auto& x : G[v]) {
				if (vis[x])continue;
				id[x] = !id[v];
				q.emplace(id[x], x, v);
			}
		}

		bool isbipartite = true;
		rep(i, 0, M) {
			if (id[u[i]] == id[v[i]])
				isbipartite = false;
		}

		vector<int> ans;
		if (!isbipartite) {
			cout << 0 << endl;
			continue;
		}

		int A = 0;
		rep(i, 0, N)if (id[i])A++;
		int B = N - A;

		if (A > B)swap(A, B);

		if (A % 2 == 0)ans.push_back(A / 2);
		if (B % 2 == 0 && A != B)ans.push_back(B / 2);
		cout << ans.size() << endl;
		for (auto x : ans)
			cout << x << endl;
	}
	return 0;
}
