#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 7;
int n, m;
bool vis[N];
int head[N], h[N], scc[N], dfn[N], low[N], val[N], tag1[N];
int u, v, tot, cnte, idx;
long long sum[N];
struct Edge {
  int to, nxt;
} e[N << 2], edge[N << 2];
stack<int> t;
inline void add_edge1(int u, int v) {
  edge[++cnte].to = v;
  edge[cnte].nxt = head[u];
  head[u] = cnte;
}
inline void add_edge2(int u, int v) {
  e[++cnte].to = v;
  e[cnte].nxt = h[u];
  h[u] = cnte;
}
inline void tarjan(int st, int far) {
  low[st] = dfn[st] = ++idx;
  vis[st] = 1;
  t.push(st);
  for (int i = head[st]; i; i = edge[i].nxt) {
    int y = edge[i].to;
    if (y == far) continue;
    if (!dfn[y]) {
      tarjan(y, st);
      low[st] = min(low[st], low[y]);
    } else if (vis[y]) {
      low[st] = min(low[st], low[y]);
    }
  }
  if (dfn[st] == low[st]) {
    tot++;
    int y;
    int cnt = 2;
    do {
      y = t.top();
      t.pop();
      cnt--;
      scc[y] = tot;
      vis[y] = false;
      if (cnt == 0) tag1[tot] = 1;
      sum[tot] += val[y];
    } while (y != st);
  }
}
inline void rebuild() {
  cnte = 0;
  for (int st = 1; st <= n; st++) {
    for (int i = head[st]; i; i = edge[i].nxt) {
      int y = edge[i].to;
      if (scc[st] != scc[y]) {
        add_edge2(scc[st], scc[y]);
      }
    }
  }
}
int ST;
long long ans = 0, ans1 = 0;
inline int dfs(int u, int far) {
  int f = 0;
  f |= tag1[u];
  for (int i = h[u]; i; i = e[i].nxt) {
    int to = e[i].to;
    if (far == to) continue;
    f |= dfs(to, u);
  }
  if (f) {
    ans += sum[u];
    sum[u] = 0;
  }
  return f;
}
inline void dfs1(int u, int far, long long res) {
  res += sum[u];
  ans = max(ans1 + res, ans);
  for (int i = h[u]; i; i = e[i].nxt) {
    int to = e[i].to;
    if (far == to) continue;
    dfs1(to, u, res);
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &val[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &u, &v);
    add_edge1(u, v);
    add_edge1(v, u);
  }
  scanf("%d", &ST);
  tarjan(ST, 0);
  rebuild();
  ST = scc[ST];
  dfs(ST, 0);
  ans1 = ans;
  dfs1(ST, 0, 0);
  printf("%lld\n", ans);
  return 0;
}
