#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const int MAX=3005;
vector<pii>P[MAX];
bool V[MAX];
int L[MAX];
vi ans;

void czysc(){
   ans.clear();
   fill(L,L+MAX,0);
   fill(V,V+MAX,false);
}
void dfs1(int u){
    while (L[u]<sz(P[u])){
     int id=P[u][L[u]].nd;
     int ver=P[u][L[u]].st;
     L[u]++;
     if (V[id])continue;
     V[id]=true;
     dfs1(ver);
   }
   ans.pb(u);
}
int n,m;
void probuj(int u){
   int ile=0;
   for (int i=1;i<=n;i++){
      int sum=0;
      for (auto it:P[i]) {
         if (!V[it.nd]) sum++;
      }
      if (sum&1 && i!=u){
         ile++;
      }
   }
   if (ile>=2)return;
   dfs1(u);
}
int32_t main(){
  BOOST;
  cin>>n>>m;
  for (int i=1;i<=m;i++){
    int a,b;
    cin>>a>>b;
    P[a].pb(mp(b,i));
    P[b].pb(mp(a,i));
  }
  
  for (int center=1;center<=n;center++){
    vi blokuj;
    blokuj.clear();
    czysc();
    for (auto it:P[center]){
      if (sz(P[it.st])%2==1)blokuj.pb(it.nd);
    }
    // phase 1
    for (auto it:blokuj){
      V[it]=true;
    }
    probuj(center);
    if (sz(ans)-1+sz(blokuj)==m){
      cerr<<"SUCCESS1\n";
      vi answer;
      answer.clear();
      for (auto it:ans)answer.pb(it);
      answer.pb(-1);
      for (auto it:P[center]){
         if (sz(P[it.st])%2==1)answer.pb(it.st),answer.pb(center);
      }
      cout<<sz(answer)<<"\n";
      for (auto it:answer)cout<<it<<" ";
      return 0;
    }
    // phase 2 - zostawiamy jakas jedna krawedz
    for (auto it:blokuj){
       // gut
       czysc();
       for (auto it2:blokuj)if (it2!=it)V[it2]=true;
       probuj(center);
       if (sz(ans)-1+sz(blokuj)-1==m){
         cerr<<"SUCCESS2\n";
         vi answer;
         answer.clear();
         for (auto iter:ans)answer.pb(iter);
         answer.pb(-1);
         for (auto iter:P[center]){
            if (sz(P[iter.st])%2==1 && iter.nd!=it)answer.pb(iter.st),answer.pb(center);
         }
         cout<<sz(answer)<<"\n";
         for (auto iter:answer)cout<<iter<<" ";
         return 0;
       }
    }
  }
  
  
  cout<<"0";
  return 0; 
}

