#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
vector<int> edges[MAXN];
long long val[MAXN];
long long dp[MAXN];
long long temp[MAXN];
long long vis[MAXN];
void addedges(int u, int v) {
  edges[u].push_back(v);
  edges[v].push_back(u);
}
void init(int n) {
  for (int i = 1; i <= n; i++) {
    edges[i].clear();
    val[i] = 0;
    vis[i] = 0;
    temp[i] = 0;
    dp[i] = 0;
  }
}
void dfs(int u, int fa) {
  vis[u] = 1;
  for (int i = 0; i < edges[u].size(); i++) {
    int v = edges[u][i];
    if (v == fa) continue;
    if (vis[v])
      temp[u] = 1;
    else {
      dfs(v, u);
      temp[u] |= temp[v];
    }
  }
  if (!temp[u]) {
    for (int i = 0; i < edges[u].size(); i++) {
      if (edges[u][i] == fa) continue;
      dp[u] = max(dp[u], dp[edges[u][i]]);
    }
    dp[u] += val[u];
  }
}
int main() {
  int n, m;
  while (cin >> n >> m) {
    init(n);
    for (int i = 1; i <= n; i++) cin >> val[i];
    for (int i = 1; i <= m; i++) {
      long long u, v;
      cin >> u >> v;
      addedges(u, v);
    }
    long long s;
    cin >> s;
    dfs(s, 0);
    long long ans = 0, max_val = 0;
    for (int i = 1; i <= n; i++) {
      if (temp[i])
        ans += val[i];
      else
        max_val = max(max_val, dp[i]);
    }
    cout << ans + max_val << endl;
  }
  return 0;
}
