#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

bool nibu;
vector<int> v[1010];
int a[1010];

void dfs(int x){
    for(auto to : v[x]){
        if(a[to]==-1){
            a[to]=!a[x];
            dfs(to);
        }
        else if(a[to]==a[x])nibu=false;
    }
}

void solve(int n,int m){
    rep(i,n){
        v[i].clear();
        a[i]=-1;
    }
    rep(i,m){
        int x,y;
        cin>>x>>y;
        --x;--y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    nibu=true;
    a[0]=0;
    dfs(0);
    if(!nibu){
        cout<<0<<endl;
        return;
    }
    int s=0,t=0;
    rep(i,n){
        if(a[i])++s;
        else ++t;
    }
    set<int> ans;
    if(s%2==0)ans.insert(s/2);
    if(t%2==0)ans.insert(t/2);
    cout<<ans.size()<<endl;
    for(auto e : ans)cout<<e<<endl;
}

int main(){
    int n,m;
    while(cin>>n>>m,n)solve(n,m);
    return 0;
}
