#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, s, u, v;
  scanf("%d %d", &n, &m);
  vector<long long> W(n);
  for (long long& w : W) scanf("%lld", &w);
  vector<set<int>> G(n);
  for (int e = 0; e < m; ++e) {
    scanf("%d %d", &u, &v);
    G[u - 1].insert(v - 1);
    G[v - 1].insert(u - 1);
  }
  scanf("%d", &s);
  --s;
  queue<int> Q;
  for (int v = 0; v < n; ++v)
    if (v != s && G[v].size() == 1) Q.push(v);
  vector<long long> W1(n, 0);
  while (!Q.empty()) {
    v = Q.front();
    u = *G[v].begin();
    Q.pop();
    W1[u] = max(W1[u], W1[v] + W[v]);
    G[u].erase(v);
    G[v].erase(u);
    if (u != s && G[u].size() == 1) Q.push(u);
  }
  long long res = *max_element(W1.begin(), W1.end());
  for (int v = 0; v < n; ++v)
    if (G[v].size() > 0) res += W[v];
  if (G[s].size() == 0) res += W[s];
  printf("%lld\n", res);
}
