#include <bits/stdc++.h>
using namespace std;
int n, m, k, x, y, us[100001], t;
vector<int> v[100001], ans;
void dfs(int x, int p) {
  us[x] = 1;
  ans.push_back(x);
  if (t) return;
  for (int i = 0; i < v[x].size(); i++) {
    int V = v[x][i];
    if (t) return;
    if (V == p && ans.size() > k) {
      cout << ans.size() << endl;
      for (int j = 0; j < ans.size(); j++) cout << ans[j] << " ";
      cout << endl;
      t = 1;
      return;
    }
    if (!us[V]) dfs(V, p);
  }
  ans.pop_back();
}
int main() {
  cin >> n >> m >> k;
  while (m--) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    memset(us, 0, sizeof(us));
    dfs(i, i);
    if (t) break;
  }
  return 0;
}
