#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long inf = 1e18;
const long double pi = 3.141592653589793238;
long long MOD = 1000000007;
const long long N = 3e5 + 10;
long long n, m;
long long score[N];
vector<long long> graph[N];
bool vis[N] = {0};
long long dp[N];
long long Free = 0, best = 0;
bool dfs(long long u, long long p) {
  vis[u] = 1;
  dp[u] = score[u];
  bool check = 1;
  for (auto v : graph[u]) {
    if (v == p) continue;
    if (vis[v])
      check = 0;
    else {
      check &= dfs(v, u);
      dp[u] = max(dp[u], score[u] + dp[v]);
    }
  }
  if (!check) Free += score[u];
  if (check) best = max(best, dp[u]);
  return check;
}
void solve() {
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cin >> score[i];
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  long long src;
  cin >> src;
  dfs(src, src);
  cout << Free + best << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
}
