#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <random>
#include <fstream>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#define int long long
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

const int INF = 2e18;
int M;
void dfs(int v, vector<multiset<int>>& graph, vector<int>& ans) {
	while (!graph[v].empty()) {
		int u = *graph[v].begin();
		graph[v].erase(graph[v].lower_bound(u));
		graph[u].erase(graph[u].lower_bound(v));
		dfs(u, graph, ans);
	}
	ans.push_back(v);
}

vector<int> find_euler(int v, vector<multiset<int>>& graph) {
	int N = graph.size();
	int u = -1;
	int cnt = 0;
	for (int i = 0; i < N; ++i) {
		if (graph[i].size() % 2 == 1) {
			if (v != i) {
				u = i;
			}
			++cnt;
		}
	}
	if (cnt > 2 || (cnt == 2 && graph[v].size() % 2 == 0)) {
		return vector<int>();
	}
	if (cnt == 2) {
		graph[u].insert(v);
		graph[v].insert(u);
	}
	vector<int> ans;
	dfs(v, graph, ans);
	if (cnt == 0) {
		return ans;
	}
	int ix = 0;
	for (int i = 0; i + 1 < ans.size(); ++i) {
		if ((ans[i] == v && ans[i + 1] == u) || (ans[i] == u && ans[i + 1] == v)) {
			ix = i;
			break;
		}
	}
	vector<int> newans;
	for (int i = ix + 1; i < ans.size(); ++i) {
		newans.push_back(ans[i]);
	}
	for (int i = 1; i <= ix; ++i) {
		newans.push_back(ans[i]);
	}
	if (newans[0] == v) {
		reverse(newans.begin(), newans.end());
	}
	return newans;
	
}

void printans(int v, vector<int>& starvertex, vector<int>& right) {
	vector<int> ans;
	for (int& e : right) {
		ans.push_back(e + 1);
	}
	if (!starvertex.empty()) {
		ans.push_back(-1);
		for (int& e : starvertex) {
			ans.push_back(e + 1);
			ans.push_back(v + 1);
		}
	}
	cout << ans.size() << endl;
	for (int& e : ans) {
		cout << e << " ";
	}
	exit(0);
}	

void find_star(int v, vector<multiset<int>>& graph) {
	vector<int> starvertex;
	for (int u : graph[v]) {
		if (graph[u].size() & 1) {
			starvertex.push_back(u);
		}
	}
	for (int& u : starvertex) {
		graph[u].erase(v);
		graph[v].erase(u);
	}
	vector<multiset<int>> thisgraph = graph;
	vector<int> ans = find_euler(v, graph);
	if (!ans.empty() && (int)ans.size() + (int)starvertex.size() == M + 1) {
		printans(v, starvertex, ans);
	}
	for (int i = 0; i < starvertex.size(); ++i) {
		int u = starvertex[i];
		graph[v].insert(u);
		graph[u].insert(v);
		vector<int> ans = find_euler(v, graph);
		if (!ans.empty() && (int)ans.size() + (int)starvertex.size() == M + 2) {
			starvertex.erase(starvertex.begin() + i);
			printans(v, starvertex, ans);
		}
		graph = thisgraph;
	}
	for (int u : starvertex) {
		graph[u].insert(v);
		graph[v].insert(u);
	}
}

int32_t main() {
	int N;
	cin >> N >> M;
	vector<multiset<int>> graph(N);
	for (int i = 0; i < M; ++i) {
		int u, v;
		cin >> u >> v;
		--u, --v;
		graph[u].insert(v);
		graph[v].insert(u);
	}
	for (int v = 0; v < N; ++v) {
		find_star(v, graph);
	}
	cout << 0;
}