#include #define For(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); ++(i)) #define rFor(i, a, b) for (int(i) = (int)(a)-1; (i) >= (int)(b); --(i)) #define rep(i, n) For((i), 0, (n)) #define rrep(i, n) rFor((i), (n), 0) #define fi first #define se second using namespace std; typedef long long lint; typedef unsigned long long ulint; typedef pair pii; typedef pair pll; template bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } template T div_floor(T a, T b) { if (b < 0) a *= -1, b *= -1; return a >= 0 ? a / b : (a + 1) / b - 1; } template T div_ceil(T a, T b) { if (b < 0) a *= -1, b *= -1; return a > 0 ? (a - 1) / b + 1 : a / b; } constexpr lint mod = 1000000007; constexpr lint INF = mod * mod; constexpr int MAX = 200010; template struct edge { int from, to; T cost; edge(int f, int t, T c) : from(f), to(t), cost(c) {} }; template struct Graph { vector>> G; int n; Graph(int n_) : n(n_) { G.resize(n); } void add_edge(int f, int t, T c) { G[f].emplace_back(f, t, c); } }; template vector dijkstra(Graph &gr, int s) { using state = pair; priority_queue, greater> que; vector d(gr.n, INF); d[s] = 0; que.emplace(0, s); while (!que.empty()) { state p = que.top(); que.pop(); int v = p.second; if (d[v] < p.first) continue; for (edge &e : gr.G[v]) { if (d[e.to] > d[v] + e.cost) { d[e.to] = d[v] + e.cost; que.emplace(d[e.to], e.to); } } } return d; } int main() { int n, m, p; scanf("%d%d%d", &n, &m, &p); int s, t; scanf("%d%d", &s, &t); --s; --t; Graph gr(2 * n); rep(i, m) { int a, b; scanf("%d%d", &a, &b); --a; --b; gr.add_edge(a, b + n, 1); gr.add_edge(a + n, b, 1); gr.add_edge(b, a + n, 1); gr.add_edge(b + n, a, 1); } auto ds = dijkstra(gr, s); auto dt = dijkstra(gr, t); vector ans; rep(i, n) { lint tmp = INF; if (p % 2 == 0) tmp = min(ds[i] + dt[i], ds[i + n] + dt[i + n]); else tmp = min(ds[i + n] + dt[i], ds[i] + dt[i + n]); if (tmp <= p) ans.push_back(i); } if (ans.empty()) puts("-1"); else { printf("%d\n", ans.size()); for (auto v : ans) printf("%d\n", v + 1); } }