#include <vector>
#include <array>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <tuple>
#include <cassert>
#include <climits>
#include <unordered_map>
#include <unordered_set>

using namespace std;

const int N = 3002;
int n, m;
int e[N][2];
bool used[N];
int ans[2*N + 2];
int ansSz = 0;
vector<int> g[N];

void clear() {
    ansSz = 0;
    for (int i = 1; i <= m; i++) {
        used[i] = 0;
    }
}

int getOther(int v, int id) {
    return e[id][0] ^ e[id][1] ^ v;
}

void dfs(int v) {
    for (int id: g[v]) {
        if (used[id]) continue;
        used[id] = 1;
        int u = getOther(v, id);
        dfs(u);
    }
    ans[ansSz++] = v;
}

void findEuler(int v) {
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        int deg = 0;
        for (int j: g[i]) {
            if (!used[j]) deg ^= 1;
        }
        if (deg && i != v) {
            cnt++;
        }
        if (cnt >= 2) return;
    }
    dfs(v);
}

void printAns(int v, vector<int> &odd) {
    if (odd.empty()) {
        cout<<ansSz<<endl;
    } else {
        cout<<ansSz + 1 + 2 * (int)odd.size()<<endl;
    }
    for (int i=0; i<ansSz; i++) {
        cout<<ans[i]<<" ";
    }
    if (!odd.empty()) {
        cout<<-1<<" ";
        for (int id: odd) {
            int u = getOther(v, id);
            cout<<u<<" "<<v<<" ";
        }
    }
    cout<<endl;
}

void solve() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> e[i][0] >> e[i][1];
        g[e[i][0]].push_back(i);
        g[e[i][1]].push_back(i);
    }
    for (int v = 1; v <= n; v++) {
        clear();
        vector<int> odd;
        for (int id: g[v]) {
            int u = getOther(v, id);
            if (g[u].size() % 2) {
                odd.push_back(id);
                used[id] = 1;
            }
        }
        findEuler(v);
        if (ansSz - 1 + (int) odd.size() == m) {
            printAns(v, odd);
            return;
        }
        for (int i = 0; i < odd.size(); i++) {
            clear();
            for (int j = 0; j < odd.size(); j++) {
                if (i == j) continue;
                used[odd[j]] = 1;
            }
            findEuler(v);
            if (ansSz - 1 + (int) odd.size() - 1 == m) {
                odd.erase(odd.begin() + i);
                printAns(v, odd);
                return;
            }
        }
    }
    cout<<0<<endl;
}


int main() {
    int T;
//    cin>>T;
//    for (int i=1; i<=T; i++) {
//        cout<<"Case #"<<i<<": ";
    solve();
//    }
}

