#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned int ui; const ll mod = 1000000007; const ll INF = (ll)1000000007 * 1000000007; typedef pair P; #define stop char nyaa;cin>>nyaa; #define rep(i,n) for(int i=0;i=0;i--) #define Rep(i,sta,n) for(int i=sta;i=sta;i--) #define rep1(i,n) for(int i=1;i<=n;i++) #define per1(i,n) for(int i=n;i>=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef long double ld; const ld eps = 1e-8; const ld pi = acos(-1.0); typedef pair LP; int dx[4]={1,-1,0,0}; int dy[4]={0,0,1,-1}; template vector dijkstra(int s,vector>> & G){ const T inf=INF; using edge=pair; priority_queue, greater > que; int n=G.size(); vector d(n,inf); vector b(n,-1); d[s]=0; que.emplace(d[s],s); while (!que.empty()){ edge p = que.top(); que.pop(); int v = p.second; if (d[v]d[v]+c){ d[u]=d[v]+c; b[u]=v; que.emplace(d[u],u); } } } return d; } int n,m,p; int s,g; void solve(){ cin >> n >> m >> p; cin >> s >> g;s--;g--; vector> G(2*n); rep(i,m){ int u,v;cin >> u >> v;u--;v--; rep(j,2){ G[2*v+j].push_back(LP(1,2*u+1-j)); G[2*u+j].push_back(LP(1,2*v+1-j)); } } vector ds=dijkstra(2*s,G),dg=dijkstra(2*g+p%2,G); vector ans={}; // rep(i,2*n){ // cout << i/2 << " " << i%2 << " " << ds[i] << " " << dg[i] << endl; // } rep(i,n){ ll mi1=ds[2*i]+dg[2*i],mi2=ds[2*i+1]+dg[2*i+1]; if(min(mi1,mi2)<=p){ ans.push_back(i+1); } } if(ans.empty()){ cout << -1 << endl; return; } cout << ans.size() << endl; rep(i,ans.size()){ cout << ans[i] << endl; } } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(50); solve(); }