import heapq N, M, S, T = map(int, input().split()) S -= 1 T -= 1 P = tuple(map(int, input().split())) G = [[] for _ in range(N)] for _ in range(M): a, b = (int(x) - 1 for x in input().split()) G[a].append(b) G[b].append(a) h = [(-P[S], S)] nonvisited = [True] * N ans = 0 X = P[S] while h: p, v = heapq.heappop(h) if -p < X: X = -p ans += 1 nonvisited[v] = False for x in G[v]: if nonvisited[x]: h.append((-P[x], x)) print(ans)