#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int w[N];
vector<int> g[N];
bool used[N];
int tin[N], tup[N];
void dfs(int v, int p) {
  static int time = 0;
  tin[v] = time++;
  tup[v] = tin[v];
  used[v] = true;
  for (int u : g[v]) {
    if (u == p) continue;
    if (!used[u]) {
      dfs(u, v);
      tup[v] = min(tup[v], tup[u]);
    } else {
      tup[v] = min(tup[v], tin[u]);
    }
  }
}
bool check(int v, int u) {
  if (tin[v] > tin[u]) swap(u, v);
  return tup[u] > tin[v];
}
void clearUsed(int n) {
  for (int i = 0; i < n; ++i) used[i] = false;
}
int comp[N];
vector<int> vecComp[N];
long long wComp[N];
void dfsComp(int v, int col) {
  used[v] = true;
  comp[v] = col;
  vecComp[col].push_back(v);
  wComp[col] += w[v];
  for (int u : g[v]) {
    if (!used[u] && !check(u, v)) dfsComp(u, col);
  }
}
vector<int> t[N];
bool has[N];
int mt[N];
void dfsTree(int v, int p = -1) {
  mt[v] = v;
  has[v] = (int)vecComp[v].size() > 1;
  for (int u : t[v]) {
    if (u == p) continue;
    dfsTree(u, v);
    if (has[u]) {
      has[v] = true;
      int a = mt[v], b = mt[u];
      if ((int)vecComp[a].size() > (int)vecComp[b].size())
        swap(a, b);
      else
        mt[v] = mt[u];
      for (int x : vecComp[a]) {
        comp[x] = b;
        vecComp[b].push_back(x);
      }
      wComp[b] += wComp[a];
      wComp[a] = 0;
      vecComp[a].clear();
    }
  }
}
long long dp[N];
bool inPath[N];
bool dfsLast(int v, int p) {
  bool res = false;
  for (int u : t[v]) {
    if (u == p) continue;
    if (dfsLast(u, v))
      res = true;
    else
      dp[v] = max(dp[v], dp[u] + wComp[u]);
  }
  res = res || (vecComp[v].size() > 1);
  inPath[v] = res;
  return res;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", w + i);
  while (m--) {
    static int u, v;
    scanf("%d%d", &u, &v);
    --u;
    --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0, -1);
  clearUsed(n);
  int cntComp = 0;
  for (int v = 0; v < n; ++v)
    if (!used[v]) dfsComp(v, cntComp++);
  clearUsed(n);
  for (int v = 0; v < n; ++v) {
    for (int u : g[v]) {
      if (check(u, v)) t[comp[v]].push_back(comp[u]);
    }
  }
  int s = 0;
  while (s < cntComp && (int)vecComp[s].size() <= 1) ++s;
  if (s != cntComp) {
    dfsTree(s);
    clearUsed(n);
    for (int v = 0; v < n; ++v) t[v].clear();
    for (int v = 0; v < n; ++v) {
      for (int u : g[v]) {
        int a = comp[v];
        int b = comp[u];
        if (a != b) t[a].push_back(b);
      }
    }
  }
  int start;
  scanf("%d", &start);
  --start;
  start = comp[start];
  dfsLast(start, -1);
  inPath[start] = true;
  long long sumPath = 0, ans = 0;
  for (int v = 0; v < cntComp; ++v) {
    if (vecComp[v].size()) {
      if (inPath[v]) {
        sumPath += wComp[v];
        ans = max(ans, dp[v]);
      }
    }
  }
  ans += sumPath;
  printf("%lld", ans);
}
