#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 2;
int n, m, w[N], s, t[N], o[N];
long long d[N];
vector<int> g[N];
void dfs(int u, int p) {
  o[u] = 1;
  for (auto v : g[u]) {
    if (v == p) continue;
    if (o[v])
      t[u] = 1;
    else
      dfs(v, u), t[u] |= t[v];
  }
  if (!t[u]) {
    for (auto v : g[u])
      if (v != p) d[u] = max(d[u], d[v]);
    d[u] += w[u];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  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;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  cin >> s;
  dfs(s, s);
  long long res = 0, add = 0;
  for (int i = 1; i <= n; ++i)
    if (t[i])
      res += w[i];
    else
      add = max(add, d[i]);
  cout << res + add;
  return 0;
}
