#include<iostream>
#include<cstring>
#include<cstdio>
#include<climits>
#include<algorithm>
#include<queue>
#include<vector>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
inline int read(){
	int f=1,ans=0; char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}
	return f*ans;
}
const int MAXN=3e3+11;
struct Edge{int u,v,nex;}E[MAXN<<1];
int head[MAXN],d[MAXN],cnt,N,M,vis[MAXN],now[MAXN],Vis[MAXN],num=0;
int P[MAXN],ps;
pii sta[MAXN]; int tot=0;
void add(int u,int v){E[cnt].u=u,E[cnt].v=v,E[cnt].nex=head[u],head[u]=cnt++;}
vector<pii> vec;
void dfs(int u){
	for(int &i=now[u];i!=-1;i=E[i].nex){
		//cerr<<i<<" "<<E[i].u<<" "<<E[i].v<<" "<<Vis[i>>1]<<endl;
		if(Vis[i>>1]) continue; if(vis[i>>1]) continue; vis[i>>1]=1;
		int u=E[i].u,v=E[i].v; dfs(E[i].v); 
		vec.pb(mp(v,u));
		if(i==-1) break;
	}return;
}
void Get(int S){
	memset(vis,0,sizeof(vis)); vec.clear();
	for(int i=1;i<=N;i++) now[i]=head[i]; 
	dfs(S);
	return;
}
int Ans[MAXN<<1];
int main(){
	//freopen("C.in","r",stdin);
	memset(head,-1,sizeof(head));
	N=read(),M=read(); for(int i=1;i<=M;i++){int u=read(),v=read();d[u]++,d[v]++;add(u,v),add(v,u);}
	for(int i=1;i<=N;i++) if(d[i]&1) ++num;
	if(num<=2){
		ps=1; for(int i=1;i<=N;i++) if(d[i]&1){ps=i;break;}
		Get(ps); 
		if(vec.size()==M){
			printf("%d\n",M+1);
			for(int i=0;i<M;i++) printf("%d ",vec[i].fi); printf("%d",vec[M-1].se);printf("\n");
			return 0;
		}
	}
	for(int u=1;u<=N;u++){
		tot=0; memset(Vis,0,sizeof(Vis)); memset(P,0,sizeof(P)); P[u]=1;
		for(int i=head[u];i!=-1;i=E[i].nex){int v=E[i].v; if(d[v]&1) sta[++tot]=mp(i,v),P[v]=1,Vis[i>>1]=1;}
		num=0; for(int i=1;i<=N;i++) if(!P[i]&&(d[i]&1)) ++num,ps=i;
		if(num==1){
			Get(u); int siz=vec.size();
			if(siz+tot==M&&vec[0].fi==ps){
				for(int i=0;i<siz;i++) Ans[++Ans[0]]=vec[i].fi; Ans[++Ans[0]]=u; Ans[++Ans[0]]=-1;
				for(int i=1;i<=tot;i++) Ans[++Ans[0]]=sta[i].se,Ans[++Ans[0]]=u;
				printf("%d\n",Ans[0]); for(int i=1;i<=Ans[0];i++) printf("%d ",Ans[i]); printf("\n");
				return 0;
			}
		}
		if(!num){
			for(int i=head[u];i!=-1;i=E[i].nex){
				if(!P[E[i].v]) continue;
				int v=E[i].v; Vis[i>>1]=0;
				Get(u); int siz=vec.size();
				if(siz+tot-1==M&&vec[0].fi==v){
					for(int i=0;i<siz;i++) Ans[++Ans[0]]=vec[i].fi; Ans[++Ans[0]]=u; Ans[++Ans[0]]=-1;
					for(int i=1;i<=tot;i++) if(sta[i].se!=v) Ans[++Ans[0]]=sta[i].se,Ans[++Ans[0]]=u;
					printf("%d\n",Ans[0]); for(int i=1;i<=Ans[0];i++) printf("%d ",Ans[i]); printf("\n");
					return 0;
				} Vis[i>>1]=1;
			}
		}
	}
	printf("0\n");
}/*
7 8
2 4
4 5
4 1
6 3
6 4
3 5
7 5
3 7s
*/