#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > v[200000 + 1];
vector<long long> t[200000 + 1];
pair<long long, long long> e[200000 + 1];
long long w[200000 + 1], low[200000 + 1], tin[200000 + 1], comp[200000 + 1],
    sum[200000 + 1], sz[200000 + 1], dp[200000 + 1][2];
long long s, tim = 0;
vector<bool> is_bridge(200000 + 1, 0), vis(200000 + 1, 0), ok(200000 + 1);
long long n, m;
void dfs(long long node, long long par = -1) {
  tin[node] = ++tim;
  low[node] = tim;
  vis[node] = 1;
  for (auto x : v[node]) {
    if (x.first == par) continue;
    if (vis[x.first]) {
      low[node] = min(tin[x.first], low[node]);
    } else {
      dfs(x.first, node);
      low[node] = min(low[node], low[x.first]);
      if (low[x.first] > tin[node]) is_bridge[x.second] = 1;
    }
  }
}
void dfs2(long long node, long long c) {
  comp[node] = c;
  sz[c]++;
  vis[node] = 1;
  sum[c] += w[node];
  for (auto x : v[node]) {
    if (vis[x.first] or is_bridge[x.second]) continue;
    dfs2(x.first, c);
  }
}
void dfs3(long long node, long long par = -1) {
  for (auto x : t[node]) {
    if (x == par) continue;
    dfs3(x, node);
    if (ok[x]) {
      dp[node][0] += dp[x][0];
    }
    ok[node] = ok[node] | ok[x];
  }
  dp[node][0] += sum[node];
  long long temp = 0;
  for (auto x : t[node]) {
    if (x == par) continue;
    temp = max(temp, dp[x][1] + ((!ok[x]) ? sum[x] : 0));
  }
  dp[node][1] = temp;
}
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (long long i = 1; i < n + 1; i++) cin >> w[i];
  for (long long i = 1; i < m + 1; i++) {
    long long a, b;
    cin >> a >> b;
    e[i] = {a, b};
    v[a].push_back({b, i});
    v[b].push_back({a, i});
  }
  cin >> s;
  dfs(1);
  for (long long i = 1; i < n + 1; i++) vis[i] = 0;
  tim = 0;
  for (long long i = 1; i < n + 1; i++) {
    if (vis[i]) continue;
    dfs2(i, ++tim);
  }
  for (long long i = 1; i < m + 1; i++) {
    if (comp[e[i].first] == comp[e[i].second]) continue;
    t[comp[e[i].first]].push_back(comp[e[i].second]);
    t[comp[e[i].second]].push_back(comp[e[i].first]);
  }
  for (long long i = 1; i < tim + 1; i++) ok[i] = (sz[i] > 1);
  dfs3(comp[s]);
  long long ans = dp[comp[s]][0] + dp[comp[s]][1];
  cout << ans << '\n';
}
