#include using namespace std; int main() { int N, M, S, T; cin >> N >> M >> S >> T; S--; T--; vector p(N); for (int i = 0; i < N; i++) cin >> p[i]; vector> G(N); for (int i = 0; i < M; i++) { int a, b; cin >> a >> b; a--; b--; G[a].push_back(b); G[b].push_back(a); } priority_queue> que; vector seen(N, false); seen[S] = true; for (auto nv : G[S]) { seen[nv] = true; que.emplace(p[nv], nv); } int ans = 0; int mini = p[S]; while (!que.empty()) { auto pa = que.top(); que.pop(); int v = pa.second; if (pa.first < mini) { mini = pa.first; ans++; } for (auto nv : G[v]) { if (seen[nv]) continue; seen[nv] = true; que.emplace(p[nv], nv); } } cout << ans << endl; }