#include "bits/stdc++.h"

using namespace std;

void Calculate_Depth(vector<vector<int>>&edge, vector<int>&depth, int stnode) {
	depth[stnode] = 0;
	queue<int>Q;
	Q.push(stnode);
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		for (auto i : edge[cn]) {
			if (depth[i] > depth[cn] + 1) {
				depth[i] = depth[cn] + 1;
				Q.push(i);
			}
		}
	}
	return;
}

int main(){
	int N,M;
	while(cin>>N>>M,N){
		vector<vector<int>>edge(N);
		for(int i=0;i<M;i++){
			int a,b;
			cin>>a>>b;
			a--;
			b--;
			edge[a].push_back(b);
			edge[b].push_back(a);
		}
		vector<int>depth(N,100000);
		Calculate_Depth(edge,depth,0);
		int odd=0,even=0;
		for(int i=0;i<N;i++){
			if(depth[i]&1)odd++;
			else even++;
		}
		for(int i=0;i<N;i++){
			for(auto j:edge[i]){
				if(depth[i]==depth[j])odd=1,even=3;
			}
		}
		set<int>ans;
		
		if(odd%2==0)ans.insert(odd/2);
		if(even%2==0)ans.insert(even/2);
		//if(odd==even)ans.insert(odd);
		//cout<<N<<endl;
		//cout<<odd<<" "<<even<<endl;
		cout<<ans.size()<<endl;
		for(auto i:ans)cout<<i<<endl;
	}
}
