#include <iostream>
#include <cassert>
#include <vector>
#include <algorithm>
using namespace std;

bool dfs(vector< vector<int> > &G, vector<int> &C, int v){
  int c = 1 - C[v];
  bool f = true;
  for(size_t i = 0; i < G[v].size(); ++i){
    int v_ = G[v][i];
    if(C[v_] >= 0 && C[v_] != c) return false;
    if(C[v_] >= 0) continue;
    C[v_] = c;
    f &= dfs(G,C,v_);
  }
  return f;
}

int main(){
  int N, M;
  while(cin >> N >> M, N){
    vector< vector<int> > G(N);
    for(int i = 0; i < M; ++i){
      int u, v;
      cin >> u >> v;
      --u;--v;
      G[u].emplace_back(v);
      G[v].emplace_back(u);
    }
    vector<int> C(N,-1);
    C[0] = 0;
    if(!dfs(G,C,0)){
      cout << 0 << endl;
      continue;
    }
    int c = 0;
    for(int i = 0; i < N; ++i){
      c += C[i];
      //cerr << "C[" << i << "] = " << C[i] << endl;
      assert(C[i] >= 0);
    }
    c = min(c, N-c);
    vector<int> ans;
    if(!(c%2)) ans.emplace_back(c/2);
    if(2*c != N && !((N-c)%2)) ans.emplace_back((N-c)/2);
    cout << ans.size() << endl;
    for(size_t i = 0; i < ans.size(); ++i) cout << ans[i] << endl;
  }
  return 0;
}

