import java.util.*; public class Main { static final int MAX = Integer.MAX_VALUE / 10; public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int pp = sc.nextInt(); int s = sc.nextInt() - 1; int g = sc.nextInt() - 1; ArrayList> graph = new ArrayList<>(); for (int i = 0; i < n; i++) { graph.add(new ArrayList<>()); } for (int i = 0; i < m; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; graph.get(a).add(b); graph.get(b).add(a); } int[][] costsS = new int[2][n]; int[][] costsG = new int[2][n]; Arrays.fill(costsS[0], MAX); Arrays.fill(costsS[1], MAX); Arrays.fill(costsG[0], MAX); Arrays.fill(costsG[1], MAX); PriorityQueue queue = new PriorityQueue<>(); queue.add(new Path(s, 0)); while (queue.size() > 0) { Path p = queue.poll(); if (costsS[p.value % 2][p.idx] <= p.value) { continue; } costsS[p.value % 2][p.idx] = p.value; for (int x : graph.get(p.idx)) { queue.add(new Path(x, p.value + 1)); } } queue.add(new Path(g, 0)); while (queue.size() > 0) { Path p = queue.poll(); if (costsG[p.value % 2][p.idx] <= p.value) { continue; } costsG[p.value % 2][p.idx] = p.value; for (int x : graph.get(p.idx)) { queue.add(new Path(x, p.value + 1)); } } ArrayList ans = new ArrayList<>(); for (int i = 0; i < n; i++) { if (costsS[0][i] + costsG[pp % 2][i] <= pp || costsS[1][i] + costsG[(pp + 1) % 2][i] <= pp) { ans.add(i + 1); } } if (ans.size() == 0) { System.out.println(-1); } else { StringBuilder sb = new StringBuilder(); sb.append(ans.size()).append("\n"); for (int x : ans) { sb.append(x).append("\n"); } System.out.print(sb); } } static class Path implements Comparable { int idx; int value; public Path(int idx, int value) { this.idx = idx; this.value = value; } public int compareTo(Path another) { return value - another.value; } } }