#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
long long n, m, u, v, st, cnt, a[N], check[N], num[N], low[N];
long long sz[N], val[N], sub[N], good[N];
vector<int> adj[N];
vector<pair<int, int> > edge;
map<pair<int, int>, bool> bridge;
void dfs(int u, int p) {
  check[u] = 1;
  num[u] = low[u] = ++cnt;
  for (int v : adj[u]) {
    if (check[v] == 0) {
      dfs(v, u);
      low[u] = min(low[u], low[v]);
      if (num[u] < low[v]) {
        bridge[{u, v}] = bridge[{v, u}] = 1;
      }
    } else {
      if (v != p) {
        low[u] = min(low[u], num[v]);
      }
    }
  }
}
void dfs1(int u) {
  check[u] = cnt;
  val[cnt] += a[u];
  for (int v : adj[u]) {
    if (check[v] == 0) {
      dfs1(v);
    }
  }
}
void dfs2(int u, int p) {
  good[u] = (sz[u] > 1);
  sub[u] = 0;
  for (int v : adj[u]) {
    if (v != p) {
      dfs2(v, u);
      good[u] |= good[v];
      sub[u] = max(sub[u], sub[v]);
    }
  }
  sub[u] += val[u];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
    edge.push_back({u, v});
  }
  cin >> st;
  dfs(st, st);
  for (int i = 1; i <= n; i++) {
    check[i] = 0;
    adj[i].clear();
  }
  for (auto tmp : edge) {
    u = tmp.first;
    v = tmp.second;
    if (bridge[{u, v}] == 0) {
      adj[u].push_back(v);
      adj[v].push_back(u);
    }
  }
  cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (check[i] == 0) {
      cnt++;
      dfs1(i);
    }
  }
  for (int i = 1; i <= n; i++) {
    adj[i].clear();
    sz[check[i]]++;
  }
  for (auto tmp : edge) {
    u = tmp.first;
    v = tmp.second;
    if (bridge[{u, v}] == 1) {
      adj[check[u]].push_back(check[v]);
      adj[check[v]].push_back(check[u]);
    }
  }
  int root = check[st];
  dfs2(root, root);
  long long ans = 0, mx = 0;
  for (int i = 1; i <= cnt; i++) {
    if (good[i] == 1) {
      ans += val[i];
    } else {
      mx = max(mx, sub[i]);
    }
  }
  cout << ans + mx;
}
