#include <bits/stdc++.h>
using vi = std::vector<long long int>;
using vvi = std::vector<vi>;
using pii = std::pair<long long int, long long int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
using namespace std;
const long long int N = 2e5 + 10;
const long long int inf = 1e18 + 10;
const long double Pi = 3.14159265;
long long int n, m, x, y, s, A[N], vis[N], dp[N], cycler_sum;
set<pii> used_roads;
vi a[N];
long long int dfs(long long int u, long long int p = -1) {
  vis[u] = 1;
  dp[u] = A[u];
  long long int hit_cycle = 0;
  for (auto i : a[u]) {
    if (vis[i] == 1 and i != p) {
      hit_cycle = 1;
    }
    if (vis[i] == 0) {
      vis[i] = 1;
      if (dfs(i, u) == 1) hit_cycle = 1;
      dp[u] = max(dp[u], dp[i] + A[u]);
    }
  }
  if (hit_cycle == 1)
    cycler_sum += A[u];
  else
    x = max(x, dp[u]);
  return hit_cycle;
}
void solve() {
  cin >> n >> m;
  for (long long int i = 1; i <= n; i++) cin >> A[i];
  for (long long int i = 1; i <= m; i++)
    cin >> x >> y, a[x].push_back(y), a[y].push_back(x);
  cin >> s;
  x = 0;
  dfs(s);
  cout << cycler_sum + x;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  long long int xx = 0;
  return 0;
}
