import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 4); int n = Integer.parseInt(first[0]); int m = Integer.parseInt(first[1]); int s = Integer.parseInt(first[2]) - 1; int t = Integer.parseInt(first[3]) - 1; String[] second = br.readLine().split(" ", n); Town[] towns = new Town[n]; ArrayList> graph = new ArrayList<>(); for (int i = 0; i < n; i++) { towns[i] = new Town(i, Integer.parseInt(second[i])); graph.add(new ArrayList<>()); } for (int i = 0; i < m; i++) { String[] line = br.readLine().split(" ", 2); int a = Integer.parseInt(line[0]) - 1; int b = Integer.parseInt(line[1]) - 1; graph.get(a).add(b); graph.get(b).add(a); } PriorityQueue queue = new PriorityQueue<>(); queue.add(towns[s]); boolean[] visited = new boolean[n]; visited[s] = true; int score = Integer.MAX_VALUE; int count = 0; while (queue.size() > 0) { Town y = queue.poll(); if (score > y.value) { score = y.value; count++; } for (int x : graph.get(y.idx)) { if (!visited[x]) { queue.add(towns[x]); visited[x] = true; } } } System.out.println(count - 1); } static class Town implements Comparable { int idx; int value; public Town(int idx, int value) { this.idx = idx; this.value = value; } public int compareTo(Town another) { return another.value - value; } } }