#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const long long INF = mod * mod;
const long double eps = 1e-5;
const long double pi = acos(-1.0);
int n, m;
long long w[1 << 18];
vector<int> G[1 << 18];
bool canr[1 << 18];
long long score[1 << 18];
int c[1 << 18];
bool iseda[1 << 18];
long long dfs(int id, int fr) {
  long long ret = 0;
  for (int j = 0; j < G[id].size(); j++) {
    int to = G[id][j];
    if (to == fr) continue;
    ret = max(ret, dfs(to, id));
  }
  return ret + w[id];
}
long long ad = 0;
bool sear(int id, int fr) {
  for (int j = 0; j < G[id].size(); j++) {
    int to = G[id][j];
    if (to == fr) continue;
    if (!iseda[to]) {
      ad += w[id];
      w[id] = 0;
      return true;
    }
    if (sear(to, id)) {
      ad += w[id];
      w[id] = 0;
      return true;
    }
  }
  return false;
}
void solve() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> w[i];
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  int s;
  cin >> s;
  s--;
  queue<int> q;
  q.push(s);
  canr[s] = true;
  while (!q.empty()) {
    int id = q.front();
    q.pop();
    for (int j = 0; j < G[id].size(); j++) {
      int to = G[id][j];
      if (canr[to]) continue;
      canr[to] = true;
      q.push(to);
    }
  }
  int cnt = 0;
  int cnte = 0;
  for (int i = 0; i < n; i++) {
    if (canr[i]) {
      cnt++;
      cnte += G[i].size();
    }
  }
  cnte /= 2;
  if (cnt == cnte + 1) {
    long long ans = 0;
    for (int j = 0; j < G[s].size(); j++) {
      ans = max(ans, dfs(G[s][j], s));
    }
    cout << ans + w[s] << endl;
  } else {
    queue<int> q;
    for (int i = 0; i < n; i++) {
      if (canr[i]) {
        c[i] = G[i].size();
      }
    }
    for (int i = 0; i < n; i++) {
      if (canr[i]) {
        if (c[i] == 1) {
          q.push(i);
          iseda[i] = true;
          score[i] = 0;
        }
      }
    }
    while (!q.empty()) {
      int id = q.front();
      q.pop();
      for (int j = 0; j < G[id].size(); j++) {
        int to = G[id][j];
        if (iseda[to]) continue;
        score[to] = max(score[to], score[id] + w[id]);
        c[to]--;
        if (c[to] == 1) {
          q.push(to);
          iseda[to] = true;
        }
      }
    }
    if (iseda[s]) {
      long long ans = 0;
      long long ma = 0;
      sear(s, -1);
      for (int i = 0; i < n; i++) {
        if (canr[i] && !iseda[i]) {
          ans += w[i];
          for (int j = 0; j < G[i].size(); j++) {
            int to = G[i][j];
            if (iseda[to]) {
              ma = max(ma, dfs(to, i));
            }
          }
        }
      }
      cout << ans + ad + ma << endl;
    } else {
      long long ans = 0;
      long long ma = 0;
      for (int i = 0; i < n; i++) {
        if (canr[i] && !iseda[i]) {
          ans += w[i];
          for (int j = 0; j < G[i].size(); j++) {
            int to = G[i][j];
            if (iseda[to]) {
              ma = max(ma, dfs(to, i));
            }
          }
        }
      }
      cout << ans + ma << endl;
    }
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
