#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define ALL(v) (v).begin(), (v).end()
#define fi first
#define se second
template <typename A, typename B> inline bool chmax(A &a, B b) {if (a < b) {a = b; return 1;} return 0;}
template <typename A, typename B> inline bool chmin(A &a, B b) {if (a > b) {a = b; return 1;} return 0;}
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const bool debug = 0;
/****************************/

int N, M;
vector<int> g[1123];
int col[1123];

bool binary_color(int u, int c) {
	col[u] = c;
	
	REP(i, g[u].size()) {
		int v = g[u][i];
		
		if (col[v] != 0 && col[u] == col[v]) return false;
		if (col[v] == 0 && !binary_color(v, -c)) return false; 
	}
	return true;
}

int main() {
	while (cin >> N >> M, N || M) {
		REP(i, N) g[i].clear();
		memset(col, 0, sizeof(col));
		
		REP(i, M) {
			int u, v;
			scanf("%d %d", &u, &v);
			u--; v--;
			g[u].push_back(v);
			g[v].push_back(u);
		}
		
		if (!binary_color(0, 1)) {
			cout << 0 << endl;
			continue;
		}
		
		int cnt[2] = {};
		REP(i, N) cnt[col[i]==1]++;
		
		vector<int> ans;
		if (!(cnt[0] & 1)) {
			ans.push_back(cnt[0] / 2);
		}
		if (!(cnt[1] & 1)) {
			ans.push_back(cnt[1] / 2);
		}
		
		sort(ALL(ans));
		ans.erase(unique(ALL(ans)), ans.end());
		
		
		if (debug) printf("@ ");
		cout << ans.size() << endl;
		REP(i, ans.size()) printf("%d\n", ans[i]);
	}
}

