#include using namespace std; #define REP(i,n) for(ll i=0;i<(ll)n;i++) #define dump(x) cerr << #x << " = " << (x) << endl; #define spa << " " << #define fi first #define se second #define ALL(a) (a).begin(),(a).end() #define ALLR(a) (a).rbegin(),(a).rend() using ld = long double; using ll = long long; using ull = unsigned long long; using pii = pair; using pll = pair; using pdd = pair; template struct V : vector { using vector::vector; }; V() -> V; V(size_t) -> V; template V(size_t, T) -> V; template vector make_vec(size_t n, T a) { return vector(n, a); } template auto make_vec(size_t n, Ts... ts) { return vector(n, make_vec(ts...)); } template ostream& operator << (ostream& os, const pair v){os << "(" << v.first << ", " << v.second << ")"; return os;} template ostream& operator<<(ostream &os, const vector &v) { for (auto &e : v) os << e << ' '; return os; } template ostream& operator<<(ostream& os, const vector> &v){ for(auto &e : v){os << e << "\n";} return os;} struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; template bool chmax(T &a, const T &b) { if (a bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } void fail() { cout << -1 << '\n'; exit(0); } inline int popcount(const int x) { return __builtin_popcount(x); } inline int popcount(const ll x) { return __builtin_popcountll(x); } template void debug(vector>&v,ll h,ll w){for(ll i=0;i void debug(vector&v,ll n){if(n!=0)cerr<>; vector graph_bfs(Graph &G, ll s){ // sは始点のリスト const int N = G.size(); vector dist(N, -1); queue qu; // initialization qu.push(s); dist[s] = 0; while(!qu.empty()){ int now = qu.front();qu.pop(); for(auto next: G[now]){ if(dist[next] != -1) continue; dist[next] = dist[now] + 1; qu.push(next); } } return dist; } int main(){ ll N, M, P, S, G; cin >> N >> M >> P >> S >> G; S--, G--; Graph H(2*N); REP(i, M){ ll u, v; cin >> u >> v; u--, v--; H[u].push_back(v+N); H[v].push_back(u+N); H[u+N].push_back(v); H[v+N].push_back(u); } auto distS = graph_bfs(H, S); auto distG = graph_bfs(H, G); V res; REP(i, N){ bool ok = false; REP(j, 2){ REP(k, 2){ ll d1 = distS[i+j*N]; ll d2 = distG[i+k*N]; if(d1==-1 or d2==-1) continue; if(d1+d2<=P and (P-d1-d2)%2==0) ok = true; } } if(ok) res.push_back(i); } if((int)res.size() == 0){ cout << -1 << endl; }else{ cout << res.size() << endl; for(auto x: res) cout << x+1 << endl; } return 0; }