#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
vector<int> g2[MAXN];
int n;
struct edge {
  int u, v, comp;
  bool bridge;
};
vector<edge> e;
void add_edge(int u, int v) {
  g2[u].push_back(e.size());
  g2[v].push_back(e.size());
  e.push_back((edge){u, v, -1, false});
}
int D[MAXN], B[MAXN], T;
int nbc;
int art[MAXN];
stack<int> st;
void dfs(int u, int pe) {
  B[u] = D[u] = T++;
  for (int ne : g2[u])
    if (ne != pe) {
      int v = e[ne].u ^ e[ne].v ^ u;
      if (D[v] < 0) {
        st.push(ne);
        dfs(v, ne);
        if (B[v] > D[u]) e[ne].bridge = true;
        if (B[v] >= D[u]) {
          art[u]++;
          int last;
          do {
            last = st.top();
            st.pop();
            e[last].comp = nbc;
          } while (last != ne);
          nbc++;
        }
        B[u] = min(B[u], B[v]);
      } else if (D[v] < D[u])
        st.push(ne), B[u] = min(B[u], D[v]);
    }
}
void doit() {
  memset(D, -1, sizeof(D));
  memset(art, 0, sizeof(art));
  nbc = T = 0;
  for (int i = 0, ThxDem = n; i < ThxDem; ++i)
    if (D[i] < 0) dfs(i, -1), art[i]--;
}
long long val[MAXN], cmp[MAXN];
long long w[MAXN], spec[MAXN], tt;
vector<int> g[MAXN];
void dfs(int pos) {
  cmp[pos] = tt;
  spec[tt]++;
  w[tt] += val[pos];
  for (auto x : g2[pos]) {
    int o = e[x].u ^ e[x].v ^ pos;
    if (!e[x].bridge && cmp[o] < 0) dfs(o);
  }
}
int am[MAXN];
int prec(int pos, int par = -1) {
  am[pos] = !spec[pos];
  for (auto x : g[pos])
    if (x != par) am[pos] += prec(x, pos);
  return am[pos];
}
vector<pair<int, int> > bads;
long long ans;
void go(int pos, int par = -1) {
  if (!am[pos])
    bads.push_back({pos, par});
  else {
    ans += w[pos];
    for (auto x : g[pos])
      if (x != par) go(x, pos);
  }
}
long long get(int pos, int par) {
  long long now = 0;
  for (auto x : g[pos])
    if (x != par) now = max(now, get(x, pos));
  return now + w[pos];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int m;
  cin >> n >> m;
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) cin >> val[i];
  for (int i = 0, ThxDem = m; i < ThxDem; ++i) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    add_edge(x, y);
  }
  doit();
  memset(cmp, -1, sizeof(cmp));
  for (int i = 0, ThxDem = n; i < ThxDem; ++i)
    if (cmp[i] < 0) dfs(i), tt++;
  for (int i = 0, ThxDem = tt; i < ThxDem; ++i) spec[i] = spec[i] == 1;
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) {
    for (auto x : g2[i]) {
      int o = e[x].u ^ e[x].v ^ i;
      if (e[x].bridge) g[cmp[i]].push_back(cmp[o]);
    }
  }
  for (int i = 0, ThxDem = tt; i < ThxDem; ++i)
    sort(g[i].begin(), g[i].end()),
        g[i].erase(unique(g[i].begin(), g[i].end()), g[i].end());
  int s;
  cin >> s;
  s--;
  int rt = cmp[s];
  prec(rt);
  go(rt);
  long long mx = 0;
  for (auto x : bads) mx = max(mx, get(x.first, x.second));
  cout << ans + mx << "\n";
}
