#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
using namespace std;

#define int64 long long
#define uint64 unsigned long long
#define pb push_back
#define mp make_pair
#define M_PI 3.1415926535898


char g[1000][1000];
int n, m;

vector<int> best;

bool cont(vector<int>& v, int item) {
	for (vector<int>::iterator i = v.begin(); i != v.end(); ++i) {
		if (*i == item) {
			return true;
		}
	}

	return false;
}

void solve(vector<int>& v, int cur) {
	if (cur == 0) {
		if (v.size() > best.size()) best = v;
		return;
	}
	for (int i = 0; i < n; ++i) {
		if (g[cur][i] && !cont(v, i)) {
			v.pb(i);
			solve(v, i);
			v.pop_back();
		}
	}
}

int main() {
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		int a, b;
		scanf("%d%d", &a, &b);
		g[a-1][b-1] = g[b-1][a-1] = 1;
	}

	vector<int> seq;
	best = seq;
	for (i = 0; i < n; ++i) {
		if (g[0][i]) {
			seq.pb(i);
			solve(seq, i);
			seq.pop_back();
		}
	}
	best.pop_back();
	cout << 1 + best.size() << endl;
	cout << "1 ";
	for (i = 0; i < best.size(); ++i) {
		cout << best[i] + 1 << ' ';
	}
	cout << endl;
	return 0;
}