#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
template <class F, class T>
T convert(F a, int p = -1) {
  stringstream ss;
  if (p >= 0) ss << fixed << setprecision(p);
  ss << a;
  T r;
  ss >> r;
  return r;
}
template <class T>
void print(T a, int p = -1) {
  if (p >= 0) cout << fixed << setprecision(p);
  cout << a;
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
const int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int dx[] = {-1, 0, +1, 0};
const int dy[] = {0, +1, 0, -1};
const int inf = (int)1e9 + 5;
const long long linf = (long long)1e16 + 5;
const double eps = 1e-9;
const double pi = 3.141592654;
vector<int> path[2];
vector<int> ans;
vector<int> adj[100001];
bool neighbor[100001];
bool mark[100001];
int father[100001];
int n, k, m, lastNode = 1, cnt;
void dfs(int v, int f);
void findPath(int v, int cnt) {
  path[cnt - 1].push_back(v);
  if (v == 1) return;
  findPath(father[v], cnt);
}
void solve(int v, int cnt) {
  findPath(v, cnt);
  for (typeof(n) i = (1); i <= (n); i++) father[i] = 0;
  if (cnt == 2) {
    int idx;
    for (typeof(((int)path[0].size()) - 1) i = (0);
         i <= (((int)path[0].size()) - 1); i++)
      ans.push_back(path[0][i]);
    for (typeof(((int)path[1].size()) - 2) i = (((int)path[1].size()) - 2);
         i >= (0); i--)
      ans.push_back(path[1][i]);
    for (typeof(((int)adj[v].size()) - 1) i = (0);
         i <= (((int)adj[v].size()) - 1); i++)
      neighbor[adj[v][i]] = true;
    for (typeof(((int)ans.size()) - 1) i = (0); i <= (((int)ans.size()) - 1);
         i++) {
      if (neighbor[ans[i]]) {
        idx = i;
        break;
      }
    }
    cout << ((int)ans.size()) - idx << endl;
    for (typeof(((int)ans.size()) - 1) i = (((int)ans.size()) - 1); i >= (idx);
         i--)
      cout << ans[i] << " ";
    cout << endl;
    ans.clear();
    exit(0);
  } else
    dfs(1, 0);
}
void dfs(int v, int f) {
  bool flag = false;
  mark[v] = true;
  father[v] = f;
  for (typeof(((int)adj[v].size()) - 1) i = (0);
       i <= (((int)adj[v].size()) - 1); i++)
    if (!mark[adj[v][i]]) {
      flag = true;
      father[adj[v][i]] = v;
      dfs(adj[v][i], v);
    }
  if (!flag) {
    cnt++;
    solve(v, cnt);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (typeof(m) i = (1); i <= (m); i++) {
    int v, u;
    cin >> v >> u;
    adj[v].push_back(u);
    adj[u].push_back(v);
  }
  dfs(1, 0);
  return 0;
}
