#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ long long N, M, P, S, G, A, B, from, to, alt, d; cin >> N >> M >> P >> S >> G; S--; G--; queue> que; vector> E(N); vector ds0(N, 1e9), ds1(N, 1e9); vector dg0(N, 1e9), dg1(N, 1e9); vector ans; for (int i=0; i < M; i++){ cin >> A >> B; A--; B--; E[A].push_back(B); E[B].push_back(A); } ds0[S] = 0; que.push({S, 0}); while(!que.empty()){ tie(from, d) = que.front(); que.pop(); for (auto to : E[from]){ alt = d+1; if (alt % 2 == 0 && ds0[to] == 1e9){ ds0[to] = alt; que.push({to, alt}); } else if (alt % 2 == 1 && ds1[to] == 1e9){ ds1[to] = alt; que.push({to, alt}); } } } dg0[G] = 0; que.push({G, 0}); while(!que.empty()){ tie(from, d) = que.front(); que.pop(); for (auto to : E[from]){ alt = d+1; if (alt % 2 == 0 && dg0[to] == 1e9){ dg0[to] = alt; que.push({to, alt}); } else if (alt % 2 == 1 && dg1[to] == 1e9){ dg1[to] = alt; que.push({to, alt}); } } } long long d1, d2; for (int i=0; i= 0 || d2 >= 0) ans.push_back(i+1); } else{ d1 = P-(ds1[i]+dg0[i]); d2 = P-(ds0[i]+dg1[i]); if (d1 >= 0 || d2 >= 0) ans.push_back(i+1); } } if (ans.size() == 0) cout << -1 << endl; else{ cout << ans.size() << endl; for (auto x : ans) cout << x << endl; } return 0; }