//枚举起始点找环, 一个简单的dfs就能找到, 复杂度O(n^2)可以试试~~~
// 还以为是深奥的图论~~~ ,这么少人过~~~~,又吓到了~~~
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <stack>
#include <algorithm>
//#include "myAlgorithm.h"
#define MAX 100005
#define INF (1e8 + 5)
#define eps 1e-8
#define Rep(s, e) for( int i = s; i <= e; i++)
#define Cep(e, s) for( int i = e; i >= s; i --)
using namespace std;
int n, m, k;
vector<vector<int> >adj;
int father[MAX], s, e;
bool v[MAX];
int lenth;
bool find(int node, int num){
if(num > n)return false;
int len = adj[node].size(), next;
if(num >= k + 1){
Rep(0, len - 1){
if(adj[node][i] == s){
e = node;
lenth = num;
return true;
}
}
}
v[node] = 1;
Rep(0, len - 1){
next = adj[node][i];
if(!v[next]){
father[next] = node;
if(find(next, num + 1)){
v[node] = 0;
return 1;
}
}
}
v[node] = 0;
return false;
}
int main()
{
//freopen("in.tx0t", "w", stdout);
while(cin>>n>>m>>k){
int a, b;
adj.assign(n + 2, vector<int>() );
Rep(1, m){
cin>>a>>b;
adj[a].push_back(b);
adj[b].push_back(a);
}///end input gragh
lenth = 0;
for(int i = 1; i <= n; i++){
if(lenth == 0){
s = i;
father[s] = s;
find(i, 1);
}else
break;
}
if(lenth){
cout<<lenth<<endl;
int tt = e;
while(tt != father[tt]){
cout<<tt<<" ";
tt = father[tt];
}cout<<tt<<endl;
}
}
return 0;
}
/*
*/