#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e12;
const long long mod = 1e9 + 7;
void faster() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const long long M = 300 + 10;
const long long N = 200 * 1000 + 10;
long long w[N];
vector<int> adj[N];
int n, m, s;
long long ans, maxi, dp[N], vis[N], has[N];
void dfs(int v, int p = -1) {
  vis[v] = 1;
  for (auto u : adj[v]) {
    if (!vis[u]) {
      dfs(u, v);
      dp[v] = max(dp[v], dp[u]);
      has[v] |= has[u];
    } else if (u != p)
      has[v] = 1;
  }
  dp[v] += w[v];
  if (has[v]) {
    ans += w[v];
  } else
    maxi = max(maxi, dp[v]);
}
int main() {
  faster();
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> w[i];
  for (int i = 0; i < m; i++) {
    int v, u;
    cin >> v >> u;
    v--, u--;
    adj[v].push_back(u);
    adj[u].push_back(v);
  }
  cin >> s;
  s--;
  dfs(s);
  cout << ans + maxi << endl;
}
