import sys readline = sys.stdin.readline from heapq import * N, M, S, T = map(int, readline().split()) S, T = S - 1, T - 1 P = list(map(int, readline().split())) G = [[] for i in range(N)] for i in range(M): A, B = map(int, readline().split()) A, B = A - 1, B - 1 G[A].append(B) G[B].append(A) Q = [] Q.append((-P[S], S)) ans = -1 now = 10 ** 18 seen = [0] * N while Q: c, u = heappop(Q) c = -c if seen[u]: continue seen[u] = 1 if c < now: ans += 1 now = c for v in G[u]: if seen[v]: continue heappush(Q, (-P[v], v)) print(ans)