#ifdef _LOCAL
#include "debug.h"
#endif
#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> graph(n + 1);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  vector<int> visited(n + 1);
  function<int(int)> dfs = [&](int u) {
    visited[u] = 1;
    int count = 1;
    for (auto &v: graph[u]) {
      if (!visited[v]) {
        count += dfs(v);
      }
    }
    return count;
  };
  if (dfs(1) != n) {
    cout << "0" << endl;
    return;
  }
  for (int i = 1; i <= n; i++) {
    vector<int> buf = {0};
    for (auto &v: graph[i]) {
      if (graph[v].size() & 1) {
        buf.push_back(v);
      }
    }
    for (auto &v: buf) {
      vector<int> deg(n + 1);
      for (int v = 1; v <= n; v++) {
        deg[v] = graph[v].size();
      }
      vector<int> stars;
      for (auto &u: buf) {
        if (u && u != v) {
          deg[i]--;
          deg[u]--;
          stars.push_back(u);
        }
      }
      int cnt = 0;
      for (int v = 1; v <= n; v++) {
        if (v != i && deg[v] % 2) {
          cnt++;
        }
      }
      if (cnt > 1) {
        continue;
      }
      vector<int> ans;
      vector<vector<int>> visited(n + 1, vector<int>(n + 1));
      for (auto &v: stars) {
        visited[i][v] = visited[v][i] = 1;
      }
      function<void(int)> euler = [&](int u) {
        for (auto &v: graph[u]) {
          if (!visited[u][v]) {
            visited[u][v] = visited[v][u] = 1;
            euler(v);
          }
        }
        ans.push_back(u);
      };
      euler(i);
      if (ans.size() - 1 + stars.size() != m) {
        continue;
      }
      cout << ans.size() + 1 + 2 * stars.size() << endl;
      for (auto &v: ans) {
        cout << v << " ";
      }
      cout << -1 << " ";
      for (auto &v: stars) {
        cout << v << " " << i << " ";
      }
      cout << endl;
      return;
    }
  }
  cout << 0 << endl;
}

int main() {
  cin.tie(0); cout.sync_with_stdio(0);
  int t = 1;
  // cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}