#include <bits/stdc++.h>
using namespace std;
int n, m;
long long w[200005];
vector<int> adj[200005];
int s;
int deg[200005];
long long line[200005];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  cin >> s;
  if (n == 1) {
    cout << w[1] << endl;
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    deg[i] = adj[i].size();
  }
  queue<int> q;
  for (int i = 1; i <= n; i++) {
    if (deg[i] == 1 and i != s) {
      q.push(i);
    }
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    deg[u] = -1;
    for (int i : adj[u]) {
      if (deg[i] < 0) {
        continue;
      }
      deg[i]--;
      line[i] = max(line[i], line[u] + w[u]);
      if (deg[i] == 1 and i != s) {
        q.push(i);
      }
    }
  }
  long long tot = 0;
  long long par = 0;
  for (int i = 1; i <= n; i++) {
    if (deg[i] != -1) {
      tot += w[i];
      par = max(par, line[i]);
    }
  }
  long long res = tot + par;
  cout << res << endl;
  return 0;
}
