#include <bits/stdc++.h>
using namespace std;
vector<int> g[100005];
bool visit[100005];
int parr[100005];
int dfs(int s, vector<int> &path) {
  visit[s] = 1;
  path.push_back(s);
  bool flag = 0;
  for (int v = 0; v < g[s].size(); v++) {
    if (!visit[g[s][v]]) {
      flag = 1;
      int d = dfs(g[s][v], path);
      if (d != -1) return d;
    }
  }
  if (flag == 0) return s;
  path.pop_back();
  return -1;
}
int main() {
  int n, m, k, u, v;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &u, &v);
    g[u - 1].push_back(v - 1);
    g[v - 1].push_back(u - 1);
  }
  vector<int> path;
  vector<int> ans;
  for (int i = 0; i < n; i++) {
    if (!visit[i]) {
      int d = dfs(i, path);
      if (d != -1) {
        for (int j = 0; j < g[d].size(); j++) parr[g[d][j]] = 1;
        int j;
        for (j = 0; j < path.size(); j++) {
          if (parr[path[j]] == 1) {
            break;
          }
        }
        for (; j < path.size(); j++) ans.push_back(path[j]);
        printf("%d\n", ans.size());
        for (j = 0; j < ans.size(); j++) printf("%d ", ans[j] + 1);
        break;
      }
    }
  }
  return 0;
}
