#include <iostream>
#include <vector>
using namespace std;
const int MN = 5e5+100;
vector<int> v[MN];
bool used[MN];
int f(int x, int ed, int lol) {
used[x] = 1;
for(int y: v[x]) {
if(used[y] && y != ed && y != lol) {
return 1;
}
if(!used[y]) {
if(f(y, x, lol)) return 1;
}
}
return 0;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n,m;
cin>>n>>m;
for(int i = 0; i < m; ++i) {
int a,b;
cin>>a>>b;
v[a].push_back(b);
v[b].push_back(a);
}
int ma = 0;
for(int i = 1; i <= n; ++i) {
ma = max(ma, (int)v[i].size());
if(v[i].size() % 2 != 0) {
cout<<0<<endl;
return 0;
}
}
int maCnt = 0;
for(int i = 1; i <= n; ++i) {
if((int)v[i].size() == ma) ++maCnt;
}
if(maCnt > 2 && ma != 2) {
cout<<0<<endl;
return 0;
}
if(maCnt > 2 && ma == 2) {
cout<<n<<endl;
for(int i = 1; i <= n; ++i) {
cout<<i<<' ';
}
cout<<endl;
return 0;
}
//eli nyt maCnt <= 2
vector<int> ans;
for(int i = 1; i <= n; ++i) {
if((int)v[i].size() == ma) {
memset(used, 0, sizeof used);
used[i] = 1;
for(int x: v[i]) {
if(!used[x] && f(x, i, i)) goto ohi;
}
ans.push_back(i);
ohi:;
}
}
cout<<ans.size()<<endl;
for(int x: ans) {
cout<<x<<' ';
}
cout<<'\n';
}