// // Created by yamunaku on 2020/08/22. // #include using namespace std; #define rep(i, n) for(int i = 0; i < (n); i++) #define repl(i, l, r) for(int i = (l); i < (r); i++) #define per(i, n) for(int i = ((n)-1); i >= 0; i--) #define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--) #define all(x) (x).begin(),(x).end() #define MOD9 998244353 #define MOD1 1000000007 #define IINF 1000000000 #define LINF 1000000000000000000 #define SP <<" "<< #define CYES cout<<"Yes"<; using mti = vector>; using vl = vector; using mtl = vector>; using pi = pair; using pl = pair; template using heap = priority_queue, function>; int main(){ //CFS; int n, m, d; cin >> n >> m >> d; int s, g; cin >> s >> g; s--, g--; mti e(n); rep(i, m){ int u, v; cin >> u >> v; u--, v--; e[u].push_back(v); e[v].push_back(u); } mti ds(n, vi(2, IINF)); mti dg(n, vi(2, IINF)); queue> bfs; ds[s][0] = 0; bfs.emplace(s, 0); while(!bfs.empty()){ auto p = bfs.front(); bfs.pop(); for(auto &nx : e[p.first]){ if(ds[nx][p.second ^ 1] != IINF) continue; ds[nx][p.second ^ 1] = ds[p.first][p.second] + 1; bfs.emplace(nx, p.second ^ 1); } } dg[g][0] = 0; bfs.emplace(g, 0); while(!bfs.empty()){ auto p = bfs.front(); bfs.pop(); for(auto &nx : e[p.first]){ if(dg[nx][p.second ^ 1] != IINF) continue; dg[nx][p.second ^ 1] = dg[p.first][p.second] + 1; bfs.emplace(nx, p.second ^ 1); } } vector ans; rep(i, n){ rep(x, 2){ rep(y, 2){ int dd = ds[i][x] + dg[i][y]; if(dd <= d && dd % 2 == d % 2){ ans.push_back(i); goto next; } } } next:; } if(ans.size() == 0){ cout << -1 << endl; return 0; } sort(all(ans)); cout << ans.size() << endl; for(auto &x : ans){ cout << x + 1 << endl; } return 0; }