#include <bits/stdc++.h>
using namespace std;
set<int> e[200010];
long long dp[200010];
int nxt[200010], w[200010];
bool vis[200010];
vector<int> q;
long long dfs(int x, int y) {
  long long sol = 0;
  for (auto& i : e[x]) {
    if (i == y) continue;
    sol = max(sol, dfs(i, x));
  }
  return sol + w[x];
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cerr.tie(nullptr);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> w[i];
  }
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    e[u].insert(v);
    e[v].insert(u);
  }
  int s;
  cin >> s;
  long long sol = 0;
  if (m == n - 1) {
    sol = dfs(s, s);
  }
  if (sol) return cout << sol << '\n', 0;
  for (int i = 1; i <= n; ++i) {
    int len = e[i].size();
    if (len == 1) q.push_back(i);
  }
  size_t cnt = 0;
  while (cnt != q.size()) {
    int x = q[cnt++];
    int c = *e[x].begin();
    dp[c] = max(dp[c], dp[x] + w[x]);
    e[c].erase(x);
    e[x].erase(c);
    int len = e[c].size();
    if (len == 1) q.push_back(c);
    vis[x] = 1;
    nxt[x] = c;
  }
  int cur = s;
  while (vis[cur]) {
    vis[cur] = 0;
    cur = nxt[cur];
  }
  long long res = 0;
  for (int i = 1; i <= n; ++i) {
    if (!vis[i]) {
      res += w[i];
    } else {
      sol = max(sol, w[i] + dp[i]);
    }
  }
  cout << res + sol << '\n';
}
