#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(register int i=(a);i>=(b);--i)
#define int long long
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 3005
#define inf 0x3f3f3f3f
#define ins insert
#define del erase
 
int n,m,d[maxn],ff[maxn];
set<int>e[maxn],to,G[maxn];
inline int getf(int x){
	return x==ff[x]?x:ff[x]=getf(ff[x]);
}
vector<int>o,del;
int ecnt,ccnt;
void euler(int u)
{
	while(G[u].size()){
		int v=*G[u].begin();
		G[u].del(v),G[v].del(u),ccnt++;
		euler(v);
	}
	o.pb(u);
}
bool check(int u)
{
//	cout<<"check "<<u<<endl;
	int cnt=0; ccnt=0; 
	For(i,1,n)cnt+=(d[i]&1);
	if(!(!cnt||(cnt==2 && d[u]%2))) return 0;
	For(i,1,n)G[i]=e[i];
	o.clear(),euler(u);
//	cout<<ccnt<<' '<<ecnt<<' '<<endl;//exit(0);
	return (ccnt+ecnt==m);
}
 
void work(int u)
{
	to.clear(); ecnt=0;
	for(auto v:e[u])if(d[v]&1)to.ins(v);
	for(auto v:to)e[u].del(v),e[v].del(u),d[u]--,d[v]--,++ecnt;
	if(check(u)){
		cout<<o.size()+1+to.size()*2<<endl;
		for(auto x:o)cout<<x<<" ";
		cout<<"-1 ";
		for(auto v:to)cout<<v<<' '<<u<<' ';
		exit(0);
	}
	vector<int>tmp;
	for(auto v:to)tmp.pb(v);
	for(auto v:tmp){
		to.del(v);
		e[u].ins(v),e[v].ins(u),d[u]++,d[v]++,--ecnt;
		if(check(u)){
			cout<<o.size()+1+to.size()*2<<endl;
			for(auto x:o)cout<<x<<" ";
			cout<<"-1 ";
			for(auto v:to)cout<<v<<' '<<u<<' ';
			exit(0);
		}
		to.ins(v);
		e[u].del(v),e[v].del(u),d[u]--,d[v]--,++ecnt; 
	}
	for(auto v:to)e[u].ins(v),e[v].ins(u),d[u]++,d[v]++;
}
 
signed main()
{
	n=read(),m=read();
	For(i,1,n)ff[i]=i;
	For(i,1,m){
		int u=read(),v=read(); ff[getf(u)]=getf(v);
		d[u]++,d[v]++,e[u].ins(v),e[v].ins(u);
	}
	int orz=0;
	For(i,1,n)orz+=(getf(i)==i);
	if(orz>1){
		puts("0");
		return 0;
	}
	if(check(1)){
		cout<<o.size()<<endl;
		for(auto x:o)cout<<x<<' ';puts("");
		return 0;
	}
	For(i,1,n) work(i);
	puts("0");
	return 0;
}
