#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
const int MAXN = 5 + 100000;
vector<int> g[MAXN], s;
bitset<MAXN> vis;
int k, pos[MAXN];
void dfs(int u) {
  assert(int(g[u].size()) >= k);
  vis[u] = true;
  pos[u] = s.size();
  s.push_back(u);
  int minp = 1e6;
  for (const int& v : g[u]) {
    if (!vis[v]) {
      dfs(v);
      return;
    }
    minp = min(minp, pos[v]);
  }
  cout << int(s.size()) - minp << '\n';
  for (int i = minp; i < (int)s.size(); ++i) {
    cout << 1 + s[i] << ' ';
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n, m;
  cin >> n >> m >> k;
  while (m--) {
    int u, v;
    cin >> u >> v;
    g[--u].push_back(--v);
    g[v].push_back(u);
  }
  vis.reset();
  s.reserve(1 + k);
  dfs(0);
  return 0;
}
