#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
const double PI = acos(-1.0);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long n, m;
const long long N = 2e5 + 100;
set<long long> adj[N];
vector<long long> adj2[N];
long long w[N];
bool vis[N];
bool dfs(long long node, long long par) {
  if (vis[node]) {
    return 1;
  }
  vis[node] = 1;
  bool flag = 0;
  vector<long long> to_remove;
  for (auto x : adj[node]) {
    if (x == par) continue;
    if (!dfs(x, node)) {
      to_remove.push_back(x);
    } else {
      flag = 1;
    }
  }
  for (auto x : to_remove) {
    adj[node].erase(x);
    adj[x].erase(node);
  }
  return flag;
}
long long ans = 0;
bool vis2[N];
long long smn[N];
long long ma = 0;
long long rec(long long node, long long par) {
  long long sum = w[node];
  long long ma2 = 0;
  for (auto x : adj2[node]) {
    if (x != par) {
      ma2 = max(ma2, rec(x, node));
    }
  }
  sum += ma2;
  return sum;
}
void dfs2(long long node) {
  if (vis2[node]) return;
  vis2[node] = 1;
  ans += w[node];
  for (auto x : adj[node]) dfs2(x);
  for (auto x : adj2[node]) {
    if (!adj[node].count(x)) {
      ma = max(ma, rec(x, node));
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    cin >> w[i];
  }
  for (long long i = 1; i <= m; i++) {
    long long u, v;
    cin >> u >> v;
    adj[u].insert(v);
    adj[v].insert(u);
    adj2[u].push_back(v);
    adj2[v].push_back(u);
  }
  long long root;
  cin >> root;
  dfs(root, root);
  dfs2(root);
  cout << ans + ma << "\n";
}
