#include <bits/stdc++.h>
#define N 100005
using namespace std;
ifstream fin ("euler.in");
ofstream fout ("euler.out");
int n, x, y, m;
list <int> L[N];
vector <int> ciclu;
void Euler(int nod)
{
while (!L[nod].empty())
{
int nod2 = L[nod].front();
L[nod].pop_front();
L[nod2].erase(find(L[nod2].begin(), L[nod2].end(), nod));
Euler(nod2);
}
ciclu.push_back(nod);
}
int main()
{
fin >> n >> m;
while (m--)
{
fin >> x >> y;
L[x].push_back(y);
L[y].push_back(x);
}
Euler(1);
fout << ciclu.size() << "\n";
for (auto &it : ciclu)
fout << it << " ";
return 0;
}