#include <bits/stdc++.h>
using pii = std::pair<long long, long long>;
using namespace std;
const long long maxn = 2e5 + 5;
long long n, m, s, u, v, w[maxn], visited[maxn], dp[2][maxn];
vector<long long> adj[maxn];
long long dfs(long long x, long long p) {
  visited[x] = 1;
  long long backedge = 0, directback = 0;
  for (auto v : adj[x])
    if (!visited[v]) {
      long long cur = dfs(v, x);
      backedge |= cur;
      if (cur) dp[1][x] += dp[1][v];
      dp[0][x] = max(dp[0][x], dp[0][v]);
    } else if (v != p && visited[v]) {
      backedge = 1;
      directback = 1;
    }
  if (backedge)
    dp[1][x] += w[x];
  else
    dp[0][x] += w[x];
  return backedge;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    cin >> w[i];
    visited[i] = 0;
    for (long long j = 0; j < 2; j++) dp[j][i] = 0;
  }
  for (long long i = 0; i < m; i++) {
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  cin >> s;
  s--;
  dfs(s, -1);
  cout << dp[0][s] + dp[1][s] << "\n";
  return 0;
}
