#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
vector<int> e[N];
int w[N];
bool seen[N];
bool comp[N];
void dfs1(int v, int p) {
  seen[v] = 1;
  for (int u : e[v])
    if (u != p) {
      if (seen[u])
        comp[v] = 1;
      else {
        dfs1(u, v);
        if (comp[u]) comp[v] = 1;
      }
    }
}
long long ans = 0;
long long dfs2(int v) {
  seen[v] = 1;
  long long res = 0;
  for (int u : e[v])
    if (!seen[u]) res = max(res, dfs2(u));
  if (comp[v])
    ans += w[v];
  else
    res += w[v];
  return res;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    e[x].push_back(y);
    e[y].push_back(x);
  }
  int s;
  cin >> s;
  dfs1(s, s);
  for (int i = 1; i <= n; i++) seen[i] = 0;
  cout << ans + dfs2(s) << '\n';
}
