#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int w[N];
vector<int> g[N];
int deg[N];
bool used[N];
long long dp[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", w + i);
  while (m--) {
    static int u, v;
    scanf("%d%d", &u, &v);
    --u;
    --v;
    g[u].push_back(v);
    g[v].push_back(u);
    ++deg[u];
    ++deg[v];
  }
  int s;
  scanf("%d", &s);
  --s;
  if (n == 1) {
    printf("%d", w[0]);
    return 0;
  }
  queue<int> Q;
  for (int v = 0; v < n; ++v)
    if (deg[v] == 1) Q.push(v);
  while (!Q.empty()) {
    int v = Q.front();
    Q.pop();
    if (!deg[v] || v == s) continue;
    int u;
    for (int p : g[v])
      if (deg[p]) u = p;
    dp[u] = max(dp[u], dp[v] + w[v]);
    --deg[v];
    --deg[u];
    if (deg[u] == 1) Q.push(u);
  }
  long long path = 0, ans = 0;
  for (int v = 0; v < n; ++v) {
    if (deg[v] || v == s) {
      path += w[v];
      ans = max(ans, dp[v]);
    }
  }
  ans += path;
  printf("%lld", ans);
}
