from heapq import heappush, heappop N,M,S,T = map(int,input().split()) S -= 1 T -= 1 P = list(map(int,input().split())) l = [[] for _ in range(N)] for _ in range(M): a,b = map(int,input().split()) a -= 1 b -= 1 l[a].append(b) l[b].append(a) st = [(-P[S],S)] visited = [False]*N visited[S] = True ans = 0 x = P[S] while st: pi,i = heappop(st) pi = -pi if x > pi: x = pi ans += 1 for j in l[i]: if not visited[j]: visited[j] = True heappush(st,(-P[j],j)) print(ans)