#include <bits/stdc++.h>
using namespace std;
namespace zyt {
const int N = 2e5 + 10, M = 2e5 + 10;
int n, m, w[N], s;
vector<int> g[N], g2[N];
namespace Tarjan {
bool vis[N];
int dfn[N], low[N], dfncnt, sta[N], belong[N], num, top;
vector<int> own[N];
void dfs(const int u, const int f) {
  dfn[u] = low[u] = ++dfncnt;
  sta[top++] = u;
  for (vector<int>::iterator it = g[u].begin(); it != g[u].end(); it++) {
    int v = *it;
    if (vis[v] || v == f) continue;
    if (dfn[v])
      low[u] = min(low[u], dfn[v]);
    else
      dfs(v, u), low[u] = min(low[u], low[v]);
  }
  if (dfn[u] == low[u]) {
    int t;
    ++num;
    do {
      t = sta[--top];
      vis[t] = true;
      belong[t] = num;
      own[num].push_back(t);
    } while (t != u);
  }
}
void build() {
  for (int i = 1; i <= n; i++)
    if (!vis[i]) dfs(i, 0);
  static int mark[N];
  for (int i = 1; i <= num; i++) {
    mark[i] = i;
    for (vector<int>::iterator it = own[i].begin(); it != own[i].end(); it++)
      for (vector<int>::iterator itt = g[*it].begin(); itt != g[*it].end();
           itt++)
        if (mark[belong[*itt]] != i)
          mark[belong[*itt]] = i, g2[i].push_back(belong[*itt]);
  }
}
}  // namespace Tarjan
pair<long long, long long> dfs(const int u, const int f) {
  long long ans0 = 0, ans1 = 0, mx = 0;
  bool flag = false;
  for (vector<int>::iterator it = g2[u].begin(); it != g2[u].end(); it++) {
    int v = *it;
    if (v == f) continue;
    pair<long long, long long> tmp = dfs(v, u);
    ans0 += max(tmp.first, 0LL);
    flag |= (tmp.first != -1);
    mx = max(mx, tmp.second - max(tmp.first, 0LL));
  }
  ans1 = ans0 + mx;
  if (Tarjan::own[u].size() == 1)
    return pair<long long, long long>(flag ? ans0 + w[Tarjan::own[u][0]] : -1,
                                      ans1 + w[Tarjan::own[u][0]]);
  else
    return pair<long long, long long>(ans0, ans1);
}
int work() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", w + i);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    g[a].push_back(b), g[b].push_back(a);
  }
  scanf("%d", &s);
  Tarjan::build();
  long long ans = 0;
  for (int i = 1; i <= Tarjan::num; i++)
    if (Tarjan::own[i].size() > 1)
      for (vector<int>::iterator it = Tarjan::own[i].begin();
           it != Tarjan::own[i].end(); it++)
        ans += w[*it];
  printf("%lld", ans + dfs(Tarjan::belong[s], 0).second);
  return 0;
}
}  // namespace zyt
int main() { return zyt::work(); }
