#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long power(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = (ans * a) % mod;
    }
    a = (a * a);
    a %= mod;
    b >>= 1;
  }
  return ans;
}
long long w[200005], best[200005], d[200005];
vector<long long> adj[200005];
bool vis[200005];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, ans = 0;
  cin >> n >> m;
  vector<long long> temp;
  for (long long i = 0; i < n; i++) {
    cin >> w[i];
    ans += w[i];
  }
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    x--;
    y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
    d[x]++;
    d[y]++;
  }
  long long s;
  cin >> s;
  s--;
  for (long long i = 0; i < n; i++) {
    if (i != s && d[i] == 1) temp.push_back(i);
  }
  long long curr = 0;
  while (!temp.empty()) {
    long long val = temp.back();
    temp.pop_back();
    ans -= w[val];
    curr = max(curr, w[val] + best[val]);
    vis[val] = true;
    for (auto& i : adj[val]) {
      if (!vis[i]) {
        d[i]--;
        best[i] = max(best[i], best[val] + w[val]);
        if (i != s && d[i] == 1) temp.push_back(i);
      }
    }
  }
  cout << ans + curr;
  return 0;
}
