#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long inf = 2e18;
const int N = 2e5 + 10;
vector<int> adj[N];
int ar[N], vis[N], safe[N];
bool dfs1(int u, int par) {
  vis[u] = 1;
  for (int v : adj[u]) {
    if (v == par) continue;
    if (vis[v]) {
      safe[u] = 1;
    } else {
      safe[u] |= dfs1(v, u);
    }
  }
  return safe[u];
}
long long mx = 0;
void dfs2(int u, int par, long long sum) {
  vis[u] = 1;
  if (!safe[u]) sum += ar[u];
  for (int v : adj[u]) {
    if ((v == par) or vis[v]) {
      continue;
    }
    dfs2(v, u, sum);
  }
  mx = max(mx, sum);
}
void add(int u, int v) {
  adj[u].push_back(v);
  adj[v].push_back(u);
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    add(u, v);
  }
  int s;
  cin >> s;
  dfs1(s, -1);
  long long answer = 0;
  for (int i = 1; i <= n; i++) {
    if (safe[i]) {
      answer += ar[i];
    }
    vis[i] = 0;
  }
  dfs2(s, -1, 0);
  cout << answer + mx << endl;
}
