#include using namespace std; int INF = 100000000; int main(){ int N, M, P; cin >> N >> M >> P; int S, G; cin >> S >> G; S--; G--; vector> E(N); for (int i = 0; i < M; i++){ int u, v; cin >> u >> v; u--; v--; E[u].push_back(v); E[v].push_back(u); } vector> E2(N * 2); for (int i = 0; i < N; i++){ for (int j : E[i]){ E2[i * 2].push_back(j * 2 + 1); E2[i * 2 + 1].push_back(j * 2); } } vector d1(N * 2, INF); d1[S * 2] = 0; queue Q1; Q1.push(S * 2); while (!Q1.empty()){ int v = Q1.front(); Q1.pop(); for (int w : E2[v]){ if (d1[w] == INF){ d1[w] = d1[v] + 1; Q1.push(w); } } } vector d2(N * 2, INF); d2[G * 2] = 0; queue Q2; Q2.push(G * 2); while (!Q2.empty()){ int v = Q2.front(); Q2.pop(); for (int w : E2[v]){ if (d2[w] == INF){ d2[w] = d2[v] + 1; Q2.push(w); } } } if (d1[G * 2 + P % 2] > P){ cout << -1 << endl; } else { vector ans; for (int i = 0; i < N; i++){ if (P % 2 == 0){ if (min(d1[i * 2] + d2[i * 2], d1[i * 2 + 1] + d2[i * 2 + 1]) <= P){ ans.push_back(i); } } if (P % 2 == 1){ if (min(d1[i * 2 + 1] + d2[i * 2], d1[i * 2] + d2[i * 2 + 1]) <= P){ ans.push_back(i); } } } int K = ans.size(); cout << K << endl; for (int i = 0; i < K; i++){ cout << ans[i] + 1 << endl; } } }