#include using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) begin(v),end(v) template inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } using ll = long long; using pii = pair; constexpr ll INF = 1ll<<30; constexpr ll longINF = 1ll<<60; constexpr ll MOD = 1000000007; constexpr bool debug = false; //---------------------------------// int main() { int N, M, P, S, G; cin >> N >> M >> P >> S >> G; --S; --G; vector> g(N); REP(i, M) { int u, v; scanf("%d %d", &u, &v); --u; --v; g[u].emplace_back(v); g[v].emplace_back(u); } auto solve = [&](int s) { vector dist(N, vector(2, INF)); // [i][j] := j=0(even), j=1(odd) queue que; // u, d que.emplace(s, 0); while (!que.empty()) { auto [u, d] = que.front(); que.pop(); for (int v : g[u]) if (chmin(dist[v][(d + 1) & 1], d + 1)) que.emplace(v, d + 1); } return dist; }; auto d1 = solve(S), d2 = solve(G); vector ans; REP(i, N) { bool ok = false; REP(j, 2) REP(k, 2) { if (d1[i][j] == INF || d2[i][k] == INF) continue; const int d = d1[i][j] + d2[i][k]; ok |= d <= P && (P - d) % 2 == 0; } if (ok) ans.emplace_back(i); } if (ans.empty()) puts("-1"); else { cout << ans.size() << endl; for (int i : ans) printf("%d\n", i + 1); } }