#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define KK 500
#define N 100005
#define MXN 200005
vector<int> v[100005];
LL ans;
int dep[100005];
int val[100005];
int a,b;
int dfs(int x,int f){
    dep[x]=dep[f]+1;
    int sum=0;
    for(auto it:v[x]){
        if(it!=f){
            if((it==a&&x==b)||(it==b&&x==a))continue;
            sum+=dfs(it,x);
        }
    }
    if(dep[x]&1)sum++;
    else sum--;
    sum+=val[x];
    ans+=abs(sum);
    return sum;
}
int vis[100005];
vector<int> circle;
vector<int> stk;
int Find;
void dfsc(int x,int f){
    stk.pb(x);
    vis[x]=1;
    for(auto it:v[x]){
        if(it!=f){
            if(vis[it]){
                while(stk.back()!=it){
                    circle.pb(stk.back());
                    stk.pop_back();
                }
                circle.pb(stk.back());
                Find=1;
            }
            else{
                dfsc(it,x);
            }
            if(Find)return;
        }
    }
    if(stk.back()==x)stk.pop_back();
}
int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    for(int i = 0;i<m;i++){
        int x,y;
        scanf("%d %d",&x,&y);
        v[x].pb(y);
        v[y].pb(x);
    }
    if(m==n){
        dfsc(1,0);
        for(auto it:circle)
        printf("%d ",it);
        printf("\n");
        if(circle.size()&1){
            a=cirlce[0],b=cirlce[1];
            int x=dfs(1,0);
            if(x&1){
                printf("-1\n");
            }
            else{
                val[circle[0]]=-x/2;
                val[circle[1]]=-x/2;
            }
            printf("%d\n",dfs(1,0));
        }
        else{
            assert(0);
        }
        return 0;
    }
    if(dfs(1,0)){
        printf("-1\n");
    }
    else
    printf("%lld\n",ans);
}
