#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  long long w[n];
  vector<int> edge[n];
  int deg[n];
  long long max_leaf[n];
  for (int i = 0; i < n; i++) {
    cin >> w[i];
    deg[i] = 0;
    max_leaf[i] = 0;
  }
  for (int i = 0; i < m; i++) {
    int t1, t2;
    cin >> t1 >> t2;
    edge[t1 - 1].push_back(t2 - 1);
    edge[t2 - 1].push_back(t1 - 1);
    deg[t1 - 1]++;
    deg[t2 - 1]++;
  }
  deque<int> leaves;
  int s;
  cin >> s;
  s--;
  for (int i = 0; i < n; i++) {
    if (i != s) {
      if (deg[i] == 1) {
        leaves.push_back(i);
      }
    }
  }
  while (!leaves.empty()) {
    int cur = leaves.front();
    int p = edge[cur][0];
    edge[p].erase(find(edge[p].begin(), edge[p].end(), cur));
    edge[cur].pop_back();
    deg[p]--;
    deg[cur]--;
    if (max_leaf[p] < max_leaf[cur] + w[cur]) {
      max_leaf[p] = max_leaf[cur] + w[cur];
    }
    if (deg[p] == 1 && p != s) leaves.push_back(p);
    leaves.pop_front();
  }
  long long ans = 0;
  if (deg[s] == 0) {
    cout << w[s] + max_leaf[s] << endl;
    return 0;
  }
  while (deg[s] == 1) {
    if (w[s] + max_leaf[s] > ans) {
      ans = w[s] + max_leaf[s];
    }
    int p = edge[s][0];
    edge[p].erase(find(edge[p].begin(), edge[p].end(), s));
    edge[s].pop_back();
    deg[p]--;
    deg[s]--;
    if (max_leaf[p] < max_leaf[s]) max_leaf[p] = max_leaf[s];
    w[p] = w[p] + w[s];
    s = p;
  }
  long long mmaxleaf = 0;
  long long oans = 0;
  for (int i = 0; i < n; i++) {
    if (deg[i] != 0) {
      oans += w[i];
      if (mmaxleaf < max_leaf[i]) mmaxleaf = max_leaf[i];
    }
  }
  oans += mmaxleaf;
  if (oans > ans) ans = oans;
  cout << ans << endl;
  return 0;
}
