#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int low[200010];
int dfn[200010];
int stk[200010];
bool instk[200010];
bool visited[200010];
set<pair<int, int>> visitedp;
vector<int> p2[200010];
int stki = 0;
int id = 0;
void scc(int v, int fa) {
  bool firstvis = dfn[v] == 0;
  if (firstvis) {
    low[v] = dfn[v] = ++id;
    stk[stki++] = v;
  }
  instk[v] = true;
  visited[v] = true;
  for (auto w : p2[v]) {
    if (w == fa) continue;
    if (!visitedp.count({v, w})) {
      visitedp.insert({v, w});
      scc(w, v);
      low[v] = min(low[v], low[w]);
    } else if (instk[w]) {
      low[v] = min(low[v], dfn[w]);
    }
  }
  int u;
  if (firstvis) {
    if (low[v] == dfn[v]) {
      do {
        u = stk[--stki];
        dfn[u] = v;
        instk[u] = false;
      } while (u != v);
    }
  }
}
long long score[200010];
vector<int> tree2[200010];
long long treescore[200010];
set<pair<int, int>> treep;
long long dfs(int idx, int fa) {
  long long ret = 0;
  for (auto item : tree2[idx]) {
    if (item == fa) continue;
    ret = max(ret, dfs(item, idx));
  }
  return treescore[idx] + ret;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i < n + 1; i++) {
    scanf("%lld", score + i);
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    p2[a].push_back(b);
    p2[b].push_back(a);
  }
  int st;
  scanf("%d", &st);
  scc(st, 0);
  for (int i = 1; i < n + 1; i++) {
    if (!visited[i]) {
      scc(i, 0);
    }
  }
  for (int i = 1; i < n + 1; i++) {
    treescore[dfn[i]] += score[i];
  }
  for (int i = 1; i < n + 1; i++) {
    for (auto item : p2[i]) {
      int p1 = dfn[i];
      int p2 = dfn[item];
      if (p1 == p2) continue;
      if (p2 > p1) swap(p1, p2);
      if (treep.count({p1, p2})) continue;
      treep.insert({p1, p2});
      tree2[p1].push_back(p2);
      tree2[p2].push_back(p1);
    }
  }
  st = dfn[st];
  cout << dfs(st, 0) << endl;
  return 0;
}
