# 常に、今まで訪れた頂点集合からいける場所のうち最も数値が小さい場所に移動する。 # heapqに、(行ける場所の数値)を入れて移動する import sys readline = sys.stdin.readline N,M,S,T = map(int,readline().split()) S -= 1 T -= 1 P = list(map(int,readline().split())) G = [[] for i in range(N)] for _ in range(M): a,b = map(int,readline().split()) G[a - 1].append(b - 1) G[b - 1].append(a - 1) import heapq as hq q = [] hq.heappush(q, (-P[S], S)) visited = [False] * N X = P[S] ans = 0 while q: p, v = hq.heappop(q) p *= (-1) if visited[v]: continue visited[v] = True if p < X: ans += 1 for child in G[v]: if visited[child]: continue hq.heappush(q, (-P[child], child)) print(ans)