#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
using namespace std;
inline int read()
{
	int f = 1, x = 0;
	char ch;

	do{
		ch = getchar();
		if (ch == '-')
			f = -1;
	}while(ch < '0' || ch > '9');
	do{
		x = x * 10 + ch - '0';
		ch = getchar();
	}while(ch >= '0' && ch <= '9');
	return f * x;
}
const int N = 3e3;

int n, m;
struct Edge {
	int to, next;
} edge[N * 2 + 2];
int vis[N + 1], start[N + 1], cur[N + 1], tot = 1;
int reald[N + 1], d[N + 1], sum;
int ans[N * 3 + 1], cnt;

inline void addedge(int u, int v)
{
	edge[++tot] = { v, start[u] };
	start[u] = tot;
	reald[u]++;
	edge[++tot] = { u, start[v] };
	start[v] = tot;
	reald[v]++;
	return;
}
inline void dfs(int u)
{
	for (int &i = cur[u]; i; i = edge[i].next) {
		int v = edge[i].to;
		if (!vis[i / 2]) {
			vis[i / 2] = 1;
			dfs(v);
		}
	}
	ans[++cnt] = u;
	return;
}
inline bool linecheck()
{
	for (int i = 1; i <= m; i++)
		if (!vis[i])
			return false;
	return true;
}
inline bool check(int u)
{
	sum = 0;
	memcpy(cur, start, 4 * (N + 1));
	for (int i = 1; i <= m; i++)
		if (vis[i] == 1)
			vis[i] = 0;
	for (int i = 1; i <= n; i++)
		sum += d[i] & 1;
	if (sum > 2)
		return false;
	if (!sum) {
		cnt = 0;
		dfs(u);
		return linecheck();
	} else {
		if ((d[u] & 1) == 0)
			return false;
		for (int i = 1; i <= n; i++) {
			if (d[i] & 1 && i != u) {
				cnt = 0;
				dfs(i);
				return linecheck();
			}
		}
	}
	return false;
}
inline bool rootcheck(int u)
{
	memcpy(d, reald, 4 * (N + 1));
	memset(vis, 0, 4 * (N + 1));
	for (int i = start[u]; i; i = edge[i].next) {
		int v = edge[i].to;
		if (d[v] & 1) {
			d[u]--;
			d[v]--;
			vis[i / 2] = 2;
		}
	}
	if (check(u))
		return true;
	for (int i = start[u]; i; i = edge[i].next) {
		int v = edge[i].to;
		if (vis[i / 2] == 2) {
			d[u]++;
			d[v]++;
			vis[i / 2] = 0;
			if (check(u))
				return true;
			d[u]--;
			d[v]--;
			vis[i / 2] = 2;
		}
	}
	return false;
}
int main()
{
	n = read();
	m = read();
	for (int i = 1; i <= m; i++)
		addedge(read(), read());

	for (int u = 1; u <= n; u++) {
		if (rootcheck(u)) {
			int ssum = 1;
			for (int i = start[u]; i; i = edge[i].next)
				if (vis[i / 2] == 2)
					ssum += 2;
			printf("%d\n", cnt + ssum);
			for (int i = cnt; i >= 1; i--)
				printf("%d ", ans[i]);
			printf("-1 ");
			for (int i = start[u]; i; i = edge[i].next) {
				int v = edge[i].to;
				if (vis[i / 2] == 2)
					printf("%d %d ", v, u);
			}
			printf("\n");
			return 0;
		}
	}

	printf("0\n");
	return 0;
}

								    			 				    	 	  	