#include <bits/stdc++.h>
template <typename T>
void rd(T& x) {
  long long f = 0, c;
  while ((c = getchar()) < 48 || 57 < c) f ^= !(c ^ 45);
  x = (c & 15);
  while (47 < (c = getchar()) && c < 58) x = x * 10 + (c & 15);
  if (f) x = -x;
}
template <typename T>
inline void pt(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) pt(x / 10);
  putchar(x % 10 + 48);
}
template <typename T>
inline void pt(T x, long long c) {
  pt(x), putchar(c);
}
template <typename T>
inline T max(const T& x, const T& y) {
  return x < y ? y : x;
}
template <typename T>
inline T min(const T& x, const T& y) {
  return x < y ? x : y;
}
const long long N = 200005;
long long n, m, all, ans, vis[N], a[N], d[N], f[N], he, ta, q[N];
bool inq[N];
struct ed {
  ed* nxt;
  long long to;
} pool[N << 1], *p = pool, *lnk[N];
void ae(long long u, long long v) { *++p = (ed){lnk[u], v}, lnk[u] = p; }
void dfs(long long u, long long sum) {
  vis[u] = 1;
  all += a[u], sum += a[u];
  if (sum > ans) ans = sum;
  for (ed* i = lnk[u]; i; i = i->nxt)
    if (!vis[i->to]) dfs(i->to, sum);
}
signed main() {
  rd(n), rd(m);
  for (long long i = (1); i <= (n); ++i) rd(a[i]);
  for (long long i = (1); i <= (m); ++i) {
    long long u, v;
    rd(u), rd(v);
    ae(u, v), ae(v, u);
    ++d[u], ++d[v];
  }
  long long s;
  rd(s);
  dfs(s, 0);
  for (long long i = (1); i <= (n); ++i)
    if (i != s && vis[i] && d[i] == 1) q[++ta] = i, f[i] = 0;
  long long sum = 0;
  while (he != ta) {
    long long u = q[++he];
    sum += a[u];
    inq[u] = 1;
    for (ed* i = lnk[u]; i; i = i->nxt) {
      if (i->to != s && vis[i->to] && --d[i->to] == 1) q[++ta] = i->to;
      if (vis[i->to]) f[i->to] = max(f[i->to], f[u] + a[u]);
    }
  }
  long long mx = 0;
  for (long long i = (1); i <= (n); ++i)
    if (!inq[i] && vis[i]) {
      if (!inq[s] || i != s) mx = max(mx, f[i]);
    }
  ans = max(ans, all - sum + mx);
  pt(ans, '\n');
  return 0;
}
