import sys import io, os input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline n, m, s, t = map(int, input().split()) s, t = s-1, t-1 P = list(map(int, input().split())) g = [[] for i in range(n)] for i in range(m): a, b = map(int, input().split()) a, b = a-1, b-1 g[a].append(b) g[b].append(a) x = P[s] y = 0 q = [] import heapq q.append((-P[s], s)) heapq.heapify(q) visit = [False]*n visit[s] = True while q: p, v = heapq.heappop(q) p *= (-1) if x > p: y += 1 x = p for u in g[v]: if visit[u]: continue visit[u] = True heapq.heappush(q, (-P[u], u)) print(y)