#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
const long long maxn = 400005;
long long used[maxn];
long long wei[maxn];
long long deg[maxn];
set<long long> mas[maxn];
long long in[maxn];
long long cur[maxn];
signed main() {
  fast();
  long long a, b, d, i, j, n, m, k, p, q, t;
  long long g, x, y, z, h;
  string s;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> wei[i];
  }
  for (i = 0; i < m; i++) {
    cin >> a >> b;
    mas[a].insert(b);
    mas[b].insert(a);
    deg[a]++;
    deg[b]++;
  }
  long long st;
  cin >> st;
  j = 0;
  for (i = 1; i <= n; i++) {
    if (deg[i] == 1 && i != st) j++, cur[j] = i;
  }
  k = 1;
  while (k <= j) {
    long long v = cur[k];
    used[v] = 1;
    for (auto to : mas[v]) {
      if (to == st) continue;
      if (used[to]) continue;
      mas[to].erase(v);
      deg[to]--;
      if (deg[to] == 1) j++, cur[j] = to;
      in[to] = max(in[to], in[v] + wei[v]);
    }
    k++;
  }
  long long ans = 0;
  for (i = 1; i <= n; i++) {
    if (!used[i]) ans += wei[i];
  }
  long long mmax = 0;
  for (i = 1; i <= n; i++) {
    if (used[i]) {
      mmax = max(mmax, wei[i] + in[i]);
    }
  }
  cout << ans + mmax;
  return 0;
}
