#include <bits/stdc++.h>
using namespace std;
const int N = 200050;
vector<int> G[N], E[N];
long long dep[N];
bool cyc_mark[N];
int mn[N], lvl[N], a[N];
bool was[N];
void DFS(int u, int p) {
  was[u] = 1;
  for (int v : G[u])
    if (v != p) {
      if (!was[v]) {
        DFS(v, u);
        E[u].push_back(v);
        if (cyc_mark[v]) cyc_mark[u] = 1;
      } else
        cyc_mark[u] = 1;
    }
}
void Calc(int u, int p) {
  dep[u] = dep[p];
  if (cyc_mark[u] == 0) dep[u] += a[u];
  for (int v : E[u]) Calc(v, u);
}
int main() {
  int n, m, s;
  scanf("%i %i", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%i", &a[i]);
  for (int i = 1, u, v; i <= m; i++)
    scanf("%i %i", &u, &v), G[u].push_back(v), G[v].push_back(u);
  scanf("%i", &s);
  DFS(s, 0);
  Calc(s, 0);
  long long mx = 0;
  for (int i = 1; i <= n; i++) mx = max(mx, dep[i]);
  long long ans = mx;
  for (int i = 1; i <= n; i++)
    if (cyc_mark[i]) ans += a[i];
  printf("%lld\n", ans);
  return 0;
}
