#include using namespace std; template class Dijkstra { public: struct edge { int to; T cost; }; int V; vector> G; vector dist; vector pre; using pti = pair; Dijkstra(int n) : V(n), G(V), dist(V, numeric_limits::max()), pre(V) {} void add(int u, int v, T cost) { G.at(u).push_back((edge) {v, cost}); G.at(v).push_back((edge) {u, cost}); } void solve(int s) { priority_queue, greater> Q; dist.at(s) = 0; Q.push(pti(0, s)); while (!Q.empty()) { pti p = Q.top(); Q.pop(); int v = p.second; if (dist.at(v) < p.first) continue; for (auto &w : G.at(v)) { if (dist.at(w.to) > dist.at(v) + w.cost) { dist.at(w.to) = dist.at(v) + w.cost; pre.at(w.to) = v; Q.push(pti(dist.at(w.to), w.to)); } } } } vector route(int from, int to) { vector res; while (true) { res.push_back(to); if (to == from) break; to = pre.at(to); } reverse(res.begin(), res.end()); return res; } }; vector> G; set SE; set ans; int lim; void dfs(int now, int pre, int d) { if (d * 2 > lim) return; ans.insert(now); for (auto next : G.at(now)) { if (next == pre) continue; if (SE.count(next)) continue; dfs(next, now, d + 1); } } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N, M, P, s, g; cin >> N >> M >> P >> s >> g; s--, g--; vector U(M), V(M); for (int i = 0; i < M; i++) { cin >> U.at(i) >> V.at(i); U.at(i)--, V.at(i)--; } Dijkstra D(N); G.resize(N); for (int i = 0; i < M; i++) { D.add(U.at(i), V.at(i), 1); G.at(U.at(i)).push_back(V.at(i)); G.at(V.at(i)).push_back(U.at(i)); } D.solve(s); if (D.dist.at(g) > P) return cout << -1 << "\n", 0; if (D.dist.at(g) % 2 != P % 2) return cout << -1 << "\n", 0; lim = P - D.dist.at(g); auto R = D.route(s, g); for (auto r : R) SE.insert(r); for (auto r : R) dfs(r, -1, 0); if (!ans.size()) return cout << -1 << "\n", 0; cout << ans.size() << "\n"; for (auto a : ans) cout << a + 1 << "\n"; }