## https://yukicoder.me/problems/no/1190 from collections import deque def calc_dist_array(N, next_nodes, start): dist = [[-1] * N for _ in range(2)] dist[0][start] = 0 queue = deque([(start, 0)]) while len(queue) > 0: v, c = queue.popleft() for nv in next_nodes[v]: if dist[1 - c][nv] == -1: dist[1 - c][nv] = dist[c][v] + 1 queue.append((nv, 1 - c)) return dist def main(): N, M, P = map(int, input().split()) S, G = map(int, input().split()) S -= 1 G -= 1 next_nodes = [[] for _ in range(N)] for _ in range(M): u, v = map(int, input().split()) u -= 1 v -= 1 next_nodes[u].append(v) next_nodes[v].append(u) dist_array_s = calc_dist_array(N, next_nodes, S) dist_array_g = calc_dist_array(N, next_nodes, G) p = P % 2 answer_set = set() for i in range(N): for js in range(2): if dist_array_s[js][i] == -1: continue if dist_array_g[(js + p) % 2][i] == -1: continue if dist_array_s[js][i] + dist_array_g[(js + p) % 2][i] > P: continue d = dist_array_s[js][i] + dist_array_g[(js + p) % 2][i] if (P - d) % 2 == 0: answer_set.add(i + 1) answer_list = list(answer_set) answer_list.sort() if len(answer_list) == 0: print(-1) else: print(len(answer_list)) for a in answer_list: print(a) if __name__ == "__main__": main()