#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 10;
vector<long long> g[N], val(N), vis(N, 0), cyc(N, 0), dp(N, 0);
void dfs(long long node, long long par = -1) {
  vis[node] = 1;
  for (auto x : g[node]) {
    if (x == par)
      continue;
    else if (vis[x] == 0) {
      dfs(x, node);
      cyc[node] = cyc[x] | cyc[node];
    } else
      cyc[node] = 1;
  }
  if (cyc[node] == 0) {
    for (auto x : g[node])
      if (x != par) dp[node] = max(dp[node], dp[x]);
    dp[node] += val[node];
  }
}
void solve() {
  long long n, m, a, b, s, ans = 0, doo = 0;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cin >> val[i];
  for (long long i = 1; i <= m; i++) {
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  cin >> s;
  dfs(s);
  for (long long i = 1; i <= n; i++) {
    if (cyc[i] == 1)
      ans += val[i];
    else
      doo = max(doo, dp[i]);
  }
  cout << ans + doo;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
}
