#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<vector<int>> G(n);
  for (int e = 0; e < m; ++e) {
    scanf("%d %d", &u, &v);
    G[u - 1].push_back(v - 1);
    G[v - 1].push_back(u - 1);
  }
  scanf("%d", &s);
  --s;
  vector<int> degree(n);
  stack<int> S;
  for (int v = 0; v < n; ++v) {
    degree[v] = G[v].size();
    if (v != s && degree[v] == 1) S.push(v);
  }
  vector<long long> W1(n, 0);
  while (!S.empty()) {
    v = S.top();
    u = *find_if(G[v].begin(), G[v].end(),
                 [&](int w) { return degree[w] > 0; });
    S.pop();
    W1[u] = max(W1[u], W1[v] + W[v]);
    --degree[u];
    --degree[v];
    if (u != s && degree[u] == 1) S.push(u);
  }
  long long res = *max_element(W1.begin(), W1.end());
  for (int v = 0; v < n; ++v)
    if (degree[v] > 0) res += W[v];
  if (degree[s] == 0) res += W[s];
  printf("%lld\n", res);
}
