#include <bits/stdc++.h>
const long long maxn = 2e5 + 5;
inline long long read() {
  char ch = getchar();
  long long w = 0, t = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') t = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    w = (w << 3) + (w << 1) + (ch ^ 48);
    ch = getchar();
  }
  return w * t;
}
struct Edge {
  long long next, to;
} edge[maxn << 1];
long long cnt_edge, head[maxn], w[maxn], ind[maxn], sum[maxn];
long long n, m, st;
inline void add_edge(long long u, long long v) {
  ind[v]++;
  edge[++cnt_edge].to = v;
  edge[cnt_edge].next = head[u];
  head[u] = cnt_edge;
}
int main() {
  n = read(), m = read();
  for (long long i = 1; i <= n; i++) w[i] = read();
  for (long long i = 1, u, v; i <= m; i++) {
    u = read(), v = read();
    add_edge(u, v);
    add_edge(v, u);
  }
  st = read();
  if (n == 1) printf("%lld", w[n]), exit(0);
  std::queue<int> q;
  for (int i = 1; i <= n; i++)
    if (i ^ st && ind[i] == 1) q.push(i);
  while (q.size()) {
    int u = q.front();
    q.pop();
    ind[u] = 0;
    for (int i = head[u]; i; i = edge[i].next) {
      int v = edge[i].to;
      if (!ind[v]) continue;
      sum[v] = std::max(sum[v], sum[u] + w[u]);
      if (v == st) continue;
      ind[v]--;
      if (ind[v] == 1) q.push(v);
    }
  }
  long long ans = 0, maxsum = 0;
  for (int i = 1; i <= n; i++) {
    if (!ind[i]) continue;
    ans += w[i];
    maxsum = std::max(maxsum, sum[i]);
  }
  printf("%lld", ans + maxsum);
  return 0;
}
