#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int MAXN = 1e6 + 10;
const int MOD = 1e9 + 7;
const int MOD2 = 998244353;
const long long INF = 8e18;
long long pw(long long a, long long b, long long mod) {
  return (!b ? 1
             : (b & 1 ? (a * pw(a * a % mod, b / 2, mod)) % mod
                      : pw(a * a % mod, b / 2, mod)));
}
int mark[MAXN], D[MAXN];
long long w[MAXN];
vector<int> G[MAXN];
long long dp[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
    sum += w[i];
  }
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
    D[a]++, D[b]++;
  }
  int s;
  cin >> s;
  D[s] = 1e9;
  G[s].push_back(s);
  deque<int> dq;
  for (int i = 1; i <= n; i++) {
    if (D[i] == 1) {
      dq.push_back(i);
      dp[i] = w[i];
    }
  }
  while (!dq.empty()) {
    int v = dq.front();
    dq.pop_front();
    sum -= w[v];
    for (auto u : G[v]) {
      D[u]--;
      if (D[u] >= 1) {
        dp[u] = max(dp[u], dp[v] + w[u]);
      }
      if (D[u] == 1) {
        dq.push_back(u);
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (1 >= D[i]) {
      ans = max(ans, dp[i]);
    }
  }
  cout << sum + ans;
  return 0;
}
