#include <bits/stdc++.h>
using namespace std;
bool visited[100005], done[100005];
int n, m, b, e, k, h[100005];
vector<int> G[100005];
vector<int> path;
bool found = false;
void DFS(int i, int lvl) {
  if (visited[i]) return;
  visited[i] = 1;
  path.push_back(i);
  h[i] = lvl;
  for (int j = 0; j < G[i].size() && !found; j++) {
    if (visited[G[i][j]] && !done[G[i][j]] && lvl - h[G[i][j]] >= k) {
      int pos = 0;
      while (path[pos] != G[i][j]) ++pos;
      printf("%d\n", lvl - pos + 1);
      for (int k = pos; k <= lvl; k++) printf("%d ", path[k]);
      printf("\n");
      found = true;
    } else
      DFS(G[i][j], lvl + 1);
  }
  done[i] = true;
  path.pop_back();
}
int main() {
  scanf("%d %d %d\n", &n, &m, &k);
  while (m--) {
    scanf("%d %d\n", &b, &e);
    G[b].push_back(e);
    G[e].push_back(b);
  }
  DFS(1, 0);
  return 0;
}
