#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
vector<int> edge[maxn];
long long w[maxn], s[maxn];
int mark[maxn], vis[maxn], pre[maxn];
void dfs(int v) {
  vis[v] = 1;
  for (int j = 0; j < edge[v].size(); j++) {
    int u = edge[v][j];
    if (vis[u]) {
      if (u != pre[v]) {
        mark[v] = 1;
      }
    } else {
      pre[u] = v;
      dfs(u);
      if (mark[u])
        mark[v] = 1;
      else
        s[v] = max(s[u], s[v]);
    }
  }
  if (!mark[v]) s[v] += w[v];
  return;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  memset(s, 0, sizeof(s));
  memset(mark, 0, sizeof(mark));
  memset(vis, 0, sizeof(vis));
  memset(pre, 0, sizeof(pre));
  int u, v;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  int st;
  scanf("%d", &st);
  dfs(st);
  long long ans = 0, maxx = 0;
  for (int i = 1; i <= n; i++) {
    if (mark[i]) ans += w[i];
    maxx = max(maxx, s[i]);
  }
  ans += maxx;
  cout << ans << endl;
}
