#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
const int maxn = 2e5 + 5;
int w[maxn], bio[maxn];
vector<int> g[maxn];
long long sol, dp[maxn], sol2;
bool vex[maxn];
int dfs(int u, int p) {
  bio[u] = 1;
  bool cycle = 0;
  for (int v : g[u]) {
    if (v != p && bio[v] == 1) {
      cycle = 1;
    } else if (!bio[v]) {
      cycle |= dfs(v, u);
    }
  }
  if (cycle) {
    sol += w[u];
    vex[u] = 1;
  }
  bio[u] = 2;
  return cycle;
}
void dfs2(int u) {
  long long dod = (!vex[u] ? w[u] : 0);
  long long ret = (!vex[u] ? w[u] : 0);
  bio[u] = 1;
  for (int v : g[u]) {
    if (!bio[v]) {
      dfs2(v);
      ret = max(ret, dp[v] + dod);
    }
  }
  dp[u] = ret;
  sol2 = max(sol2, ret);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int s;
  cin >> s;
  dfs(s, s);
  memset(bio, 0, sizeof bio);
  dfs2(s);
  cout << sol + sol2;
}
