import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int s = sc.nextInt() - 1; int t = sc.nextInt() - 1; Town[] towns = new Town[n]; ArrayList> graph = new ArrayList<>(); for (int i = 0; i < n; i++) { towns[i] = new Town(i, sc.nextInt()); 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); } PriorityQueue queue = new PriorityQueue<>(); queue.add(towns[s]); HashSet visited = new HashSet<>(); int score = Integer.MAX_VALUE; int count = 0; while (queue.size() > 0) { Town y = queue.poll(); if (score > y.value) { score = y.value; count++; } visited.add(y.idx); for (int x : graph.get(y.idx)) { if (!visited.contains(x)) { queue.add(towns[x]); } } } 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; } } }