#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e3+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n, m;
vector<pii> ed;
int dg[MAXN];

void dfs(int v, vector<vector<pii>> & adj, vector<bool> & mrk, vector<int> &ans){

    while(!adj[v].empty()){
        if(mrk[adj[v].back().ss]){
            adj[v].pop_back();
        }else{
            int dest = adj[v].back().ff;
            mrk[adj[v].back().ss] = 1;
            adj[v].pop_back();
            dfs(dest, adj, mrk, ans);
        }
    }
    ans.push_back(v);
}




bool euler(vector<pii> edg, int c, vector<int> &ans){
    vector<vector<pii>> adj(n);
    vector<bool> mrk(edg.size());
    for(int i = 0; i < edg.size(); i++){
        pii u = edg[i];
        adj[u.ff].push_back({u.ss, i});
        adj[u.ss].push_back({u.ff, i});
    }

    int start = c, odd = 0;

    for(int i = 0; i < n; i++){
        if(i == c)
            continue;
        if(adj[i].size() % 2){
            odd++;
            if(adj[c].size() % 2){
                start = i;
            }
        }
    }

    odd += (adj[c].size() % 2);
    
    if(odd != 0 && odd != 2){
        return 0;
    }else if(odd == 2 && adj[c].size() % 2 == 0){
        return 0;
    }else if(adj[c].size() == 0)
        return 0;

    assert((odd == 0) || (odd == 2 && (adj[c].size() % 2 == 1) && start != c));
    dfs(start, adj, mrk, ans);

    for(int i = 0; i < edg.size(); i++)
        if(!mrk[i])
            return 0;
    reverse(ans.begin(), ans.end());
    return 1;
}





int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);

    #ifdef Local
        freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/int.txt","r",stdin);
        freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/out.txt","w",stdout);
    #endif

    cin>>n>>m;

    for(int i = 0; i < m; i++){
        int a, b;
        cin>>a>>b;
        a--;
        b--;
        dg[a]++;
        dg[b]++;
        ed.push_back({a, b});
    }
    int odd = 0;
    for(int i = 1; i <= n; i++)
        odd += (dg[i] % 2);

    
    if(odd == 0 || odd == 2){
        int start = 0;

        for(int i = 1; i < n; i++)
            if(dg[i] % 2)
                start = i;

        vector<int> ans;
        assert(euler(ed, start, ans)); 
        cout<<ans.size()<<endl;
        for(int i: ans)
            cout<<i + 1<<" ";
        cout<<endl;
        return 0;
    }

    vector<int> ans;
    for(int c = 0; c < n; c++){
        //cerr<<c<<endl;
        ans.clear();
        vector<pii> G1, G2;       
        vector<int> dg(n, 0);
        for(int i = 0; i < m; i++){
            if(ed[i].ff == c || ed[i].ss == c)
                continue;
            G1.push_back(ed[i]);
            dg[ed[i].ff]++;
            dg[ed[i].ss]++;
        }

        for(int i = 0; i < m; i++){
            if(ed[i].ff != c && ed[i].ss != c)
                continue;
            if(ed[i].ff != c)
                swap(ed[i].ff, ed[i].ss);
            if(dg[ed[i].ss] % 2){
                G1.push_back(ed[i]);
                dg[ed[i].ss]++;
            }else{
                G2.push_back(ed[i]);
            }
        }
        if(euler(G1, c, ans)){
            ans.push_back(-2);
            for(pii u: G2){
                ans.push_back(u.ss);
                ans.push_back(u.ff);
            }
            break;
        }
        bool done = 0;
        for(pii u: G2){
            ans.clear();
            G1.push_back(u);
            if(euler(G1, c, ans)){
                ans.push_back(-2);
                for(pii v: G2){
                    if(u == v)
                        continue;
                    ans.push_back(v.ss);
                    ans.push_back(v.ff);
                }
                done = 1;
                break;
            }
            G1.pop_back();
        }

        if(done) break;
    }

    cout<<ans.size()<<endl;

    for(int i: ans)
         cout<<i + 1<<" ";
    cout<<endl;


    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}