#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
// bool debug=false;

/*---------------------------------------------------*/

int N, M, u, v;
vector<int> color(1005);
vector<int> G[1005];

void init() {
  for(int i = 0; i < 1005; i++) {
    G[i].clear();
    color[i] = -1;
  }
}

bool dfs(int curr, bool c) {
  color[curr] = c;
  for(auto next : G[curr]) {
    if(color[next] == c) return false;
    if(color[next] == -1 && !dfs(next, !c)) return false;
  }
  return true;
}

void solve(int N, int M) {
  bool ret = dfs(1, 0);
  if(!ret) {
    cout << 0 << endl;
    return ;
  }
  int a = 0, b = 0;
  for(int i = 0; i < 1005; i++) {
    if(color[i] == 0) a++;
    else if(color[i] == 1) b++;
  }
  set<int> se;
  if(a % 2 == 0) se.insert(a / 2);
  if(b % 2 == 0) se.insert(b / 2);

  cout << se.size() << endl;
  for(auto ans : se) cout << ans << endl;
}

int main() {
  while(cin >> N >> M) {
    if(N == 0 && M == 0) break;
    init();
    for(int i = 0; i < M; i++) {
      cin >> u >> v;
      G[u].push_back(v);
      G[v].push_back(u);
    }

    solve(N, M);
  }
  return 0;
}

