#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define ll long long
#define ull unsigned long long
#define fi first
#define se second
#define mpr make_pair
#define dingyi int mid = l + r >> 1, ls = p << 1, rs = p << 1 | 1
#define y0 y_csyakioi_0
#define y1 y_csyakioi_1
#define rep(i, x, y) for(int i = x; i <= y; ++i)
#define per(i, x, y) for(int i = x; i >= y; --i)
#define repg(i, u) for(int i = head[u]; i; i = e[i].nxt)
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 * 10 + (ch ^ 48); ch = getchar(); }
	return x * f;
}
const int N = 3010;
set <int> g[N], e[N], tmp, sta;
set <int> :: iterator it; 
int n, m, ans[N], len, x, y;
inline void work(int x){
	while(e[x].size()){
		int y = *e[x].begin();
		e[x].erase(y);
		e[y].erase(x);
		work(y);
	}
	ans[++len] = x;
}
inline bool check(int x){
	if(!g[x].size()) return 0; int cnt = 0;
	rep(i, 1, n) if(g[i].size() & 1) ++cnt;
	if(cnt && (cnt != 2 || (g[x].size() & 1 ^ 1))) return 0;
	rep(i, 1, n) e[i] = g[i]; len = 0; work(x);
	return len - 1 + sta.size() == m;
}
inline void print(int x){
	if(sta.size()) printf("%d\n", len + 1 + sta.size() * 2);
	else printf("%d\n", len);
	rep(i, 1, len) printf("%d ", ans[i]);
	if(sta.size()){
		printf("-1 ");
		while(sta.size()){
			int y = *sta.begin();
			printf("%d %d ", y, x);
			sta.erase(y);
		}
	}
}
inline void mian(){
	n = read(); m = read();
	rep(i, 1, m){
		x = read(); y = read();
		g[x].insert(y);
		g[y].insert(x);
	}
	rep(i, 1, n){
		tmp = g[i];
		for(it = tmp.begin(); it != tmp.end(); ++it){
			int x = (*it);
			if(g[x].size() & 1) sta.insert(x), g[x].erase(i), g[i].erase(x);
		}
		if(check(i)){ print(i); return; }
		for(it = tmp.begin(); it != tmp.end(); ++it){
			int x = (*it);
			if(g[i].count(x)) sta.insert(x), g[i].erase(x), g[x].erase(i);
			else sta.erase(x), g[i].insert(x), g[x].insert(i);
			if(check(i)){ print(i); return; }
			if(g[i].count(x)) sta.insert(x), g[i].erase(x), g[x].erase(i);
			else sta.erase(x), g[i].insert(x), g[x].insert(i);
		}
		for(it = tmp.begin(); it != tmp.end(); ++it){
			int x = (*it);
			if(!g[i].count(x)) sta.erase(x), g[i].insert(x), g[x].insert(i);
		}
	}
	puts("0");
}
int main(){ int qwq = 1; while(qwq--) mian(); return 0; }