#include <bits/stdc++.h>
using namespace std;
long long w[200005], s, mt;
vector<long long> v[200005];
long long vis[200005];
pair<long long, long long> dfs(long long z, long long p) {
  vis[z] = 1;
  long long k = w[z], q = 0, c = 0;
  for (long long x : v[z]) {
    if (x == p) continue;
    if (vis[x]) {
      c = 1;
      continue;
    }
    pair<long long, long long> y = dfs(x, z);
    if (y.second)
      c = 1, k += y.first;
    else
      q = max(q, y.first);
  }
  if (c) return {k, c};
  mt = max(mt, q + w[z]);
  return {q + w[z], c};
}
void solve() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    cin >> w[i + 1];
  }
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  cin >> s;
  pair<long long, long long> y = dfs(s, 0);
  if (y.second) {
    cout << y.first + mt;
  } else
    cout << y.first;
}
signed main() {
  ios_base::sync_with_stdio(false);
  long long t = 1;
  while (t--) solve();
  return 0;
}
