#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;
const int N = 3005;
const int M = N * N;
int ver[M<<1],nxt[M<<1],head[M<<1],vis[M<<1],tot = 1;
int deg[N],st[N],d[N],ans[N],cut[M<<1],top,n,m,t;
inline int read() {
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9') {
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}

void add(int x,int y) {
	ver[++tot] = y;
	nxt[tot] = head[x];
	head[x] = tot;
	deg[y]++;
}

void dfs(int x) {
	for(int i = head[x];i;i = nxt[i]) {
		int y = ver[i];
		if(cut[i]) continue;
		if(vis[i]) continue;
		vis[i] = vis[i ^ 1] = 1;
		dfs(y);
	}
	ans[++t] = x;
}

bool check(int x) {
	int sum = 0;
	for(int i = 1;i <= n;i++) sum += (d[i] & 1);
	if(sum > 2) return 0;
	memset(vis,0,sizeof(vis));
	if(!sum) {
		dfs(x);
		for(int j = 2;j <= tot;j++) {
			if(!vis[j] && !cut[j]) return 0;
		}
		return 1;
	}
	if(sum == 2) {
		if(d[x] % 2 == 0) return 0;
		dfs(x);
		for(int j = 2;j <= tot;j++) {
			if(!vis[j] && !cut[j]) return 0;
		}
		return 1;
	}
	return 0;
}

void print(int c) {
	int now = t;
	now++;
	for(int i = head[c];i;i = nxt[i]) {
		int y = ver[i];
		if(cut[i]) {
			now = now + 2;
		}
	}
	printf("%d\n",now);
	for(int i = 1;i <= t;i++) {
		printf("%d ",ans[i]);
	}
	printf("-1 ");
	for(int i = head[c];i;i = nxt[i]) {
		int y = ver[i];
		if(cut[i]) {
			printf("%d %d ",y,c);
		}
	}
	return;
}

int main () {
	n = read();m = read();
	for(int i = 1;i <= m;i++) {
		int u,v;
		u = read();v = read();
		add(u,v);add(v,u);
	}
	int cnt = 0;
	for(int i = 1;i <= m;i++) {
		if(deg[i] & 1) ++cnt;
		d[i] = deg[i];
	}
//	cout<<cnt<<endl;
	t = 0;
	if(!cnt) {
		dfs(1);
		printf("%d\n",t);
		for(int i = t;i;i--) printf("%d ",ans[i]);
		printf("\n");
		return 0;
	}
	t = 0;
	if(cnt == 2) {
		for(int i = 1;i <= n;i++) {
			if(deg[i] & 1) {
				dfs(i);
				break;
			}
		}
		printf("%d\n",t);
		for(int i = t;i;i--) printf("%d ",ans[i]);
		printf("\n");
		return 0;
	}
	t = 0;
	for(int c = 1;c <= n;c++) {
		int sum = cnt;
		for(int i = head[c];i;i = nxt[i]) {
			int y = ver[i];
			if(deg[y] & 1) {
				d[c]--;
				d[y]--;
				cut[i] = cut[i^1] = 1; 
			}
		}
		t = 0;
//		for(int i = 1;i <= n;i++) cout<<d[i]<<" ";
		if(check(c)) {
			print(c);
			return 0;
		}
		t = 0;
		for(int i = head[c];i;i = nxt[i]) {
			int y = ver[i];
			if(cut[i]) {
				d[c]++;
				d[y]++;
				cut[i] = cut[i ^ 1] = 0;
				if(check(c)) {
					print(c);
					return 0;
				}
				t = 0;
				cut[i] = cut[i ^ 1] = 1;
				d[c]--;
				d[y]--;
			}
		}
		for(int i = 1;i <= n;i++) d[i] = deg[i];
		for(int i = head[c];i;i = nxt[i]) {
			cut[i] = cut[i^1] = 0;
		}
	}
	puts("0");
	return 0;
}