#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m, a[N], num[N], low[N], cnt, id[N], par[N], ret[N], siz[N];
int64_t d[N], f[N], g[N];
vector<int> ke[N];
set<int> adj[N];
stack<int> S;
void dfs(int u) {
  S.push(u);
  num[u] = low[u] = ++cnt;
  for (int v : ke[u])
    if (v != par[u]) {
      if (num[v])
        low[u] = min(low[u], num[v]);
      else {
        par[v] = u;
        dfs(v);
        low[u] = min(low[u], low[v]);
      }
    }
  if (low[u] == num[u]) {
    int v;
    do {
      v = S.top();
      S.pop();
      d[u] += a[v];
      id[v] = u;
      siz[u] += 1;
    } while (v != u);
  }
}
void dfs2(int u) {
  int64_t ma = 0;
  f[u] = d[u];
  ret[u] = siz[u] > 1;
  for (int v : adj[u])
    if (v != par[u]) {
      par[v] = u;
      dfs2(v);
      ma = max(ma, g[v] - f[v]);
      f[u] += f[v];
      ret[u] |= ret[v];
    }
  g[u] = f[u] + ma;
  if (!ret[u]) f[u] = 0;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    ke[u].push_back(v);
    ke[v].push_back(u);
  }
  int s;
  scanf("%d", &s);
  dfs(s);
  for (int u = 1; u <= n; ++u)
    for (int v : ke[u])
      if (id[u] != id[v]) adj[id[u]].insert(id[v]), adj[id[v]].insert(id[u]);
  for (int i = 1; i <= n; ++i) par[i] = 0;
  dfs2(s);
  printf("%I64d", g[s]);
}
