#include <bits/stdc++.h>
using namespace std;
const int maxn = 2E5 + 20;
const int maxm = 4E5 + 40;
int n, m, cnt, tot, dfs_clock, low[maxn], dfn[maxn], bel[maxn], siz[maxn],
    to[maxm];
long long w[maxn], _w[maxn], f[maxn], h[maxn];
bool vis[maxn], isBridge[maxm], ret[maxn];
queue<int> Q;
vector<int> v[maxn], g[maxn];
void Tarjan(int x, int fa) {
  dfn[x] = low[x] = ++dfs_clock;
  for (auto u : v[x]) {
    int o = to[u];
    if (!dfn[o]) {
      Tarjan(o, x);
      low[x] = min(low[x], low[o]);
      if (low[o] > low[x]) isBridge[u] = isBridge[u ^ 1] = true;
    } else if (o != fa) {
      low[x] = min(low[x], dfn[o]);
    }
  }
}
void BFS(int s) {
  ++tot;
  Q.push(s);
  vis[s] = 1;
  while (!Q.empty()) {
    int k = Q.front();
    Q.pop();
    _w[tot] += w[k];
    bel[k] = tot;
    ++siz[tot];
    for (auto u : v[k]) {
      if (isBridge[u]) continue;
      int o = to[u];
      if (!vis[o]) Q.push(o), vis[o] = 1;
    }
  }
}
void Dfs(int x, int fa) {
  f[x] = _w[x];
  if (siz[x] > 1) ret[x] = 1;
  long long Max = 0, sum = 0;
  for (auto u : g[x]) {
    if (vis[u]) continue;
    vis[u] = 1;
    Dfs(u, x);
    if (ret[u]) {
      f[x] += f[u];
      ret[x] = 1;
    } else {
      Max = max(Max, h[u]);
    }
  }
  h[x] = f[x] + Max;
  for (auto u : g[x]) {
    if (u == fa) continue;
    h[x] = max(h[x], f[x] - f[u] + h[u]);
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(cnt);
    to[cnt++] = y;
    v[y].push_back(cnt);
    to[cnt++] = x;
  }
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) Tarjan(i, -1);
  for (int i = 1; i <= n; i++)
    if (!vis[i]) BFS(i);
  for (int i = 1; i <= n; i++)
    for (auto u : v[i]) {
      int o = to[u];
      if (bel[i] != bel[o]) g[bel[i]].push_back(bel[o]);
    }
  memset(vis, 0, sizeof(vis));
  int s;
  cin >> s;
  vis[bel[s]] = 1;
  Dfs(bel[s], -1);
  cout << h[bel[s]] << endl;
  return 0;
}
