#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(vector<T> &a, long long n) {
  T x;
  a.clear();
  for (long long i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
}
template <class T>
void write(vector<T> &a) {
  for (T x : a) cout << x << " ";
  cout << endl;
}
const int N = 200005;
int n, m, second;
int used[N];
int was[N];
long long ans;
vector<int> g[N];
vector<int> tr[N];
int p[N];
long long val[N];
vector<pair<int, int> > e;
set<pair<int, int> > tree;
long long mx;
pair<int, int> first(int u, int v) { return make_pair(min(u, v), max(u, v)); }
void dfs(int u, int par = -1) {
  p[u] = par;
  used[u] = 1;
  if (par != -1) {
    tr[u].push_back(par);
    tr[par].push_back(u);
  }
  tree.insert(first(u, par));
  for (int i = 0; i < g[u].size(); i++)
    if (!used[g[u][i]]) dfs(g[u][i], u);
}
void dfs2(int u, long long cur) {
  mx = max(cur + val[u], mx);
  used[u] = 1;
  for (int i = 0; i < tr[u].size(); i++)
    if (!used[tr[u][i]]) dfs2(tr[u][i], cur + val[u]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> val[i];
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    e.push_back(make_pair(a, b));
    g[a].push_back(b);
    g[b].push_back(a);
  }
  cin >> second;
  if (g[second].size() == 1) {
    was[second] = 1;
    second = g[second][0];
  }
  dfs(second);
  for (int i = 0; i < e.size(); i++) {
    int a = e[i].first;
    int b = e[i].second;
    if (tree.count(first(a, b))) continue;
    while (a != -1 && !was[a]) {
      was[a] = 1;
      a = p[a];
    }
    while (b != -1 && !was[b]) {
      was[b] = 1;
      b = p[b];
    }
  }
  for (int i = 1; i <= n; i++)
    if (was[i]) ans += val[i];
  memset(used, 0, sizeof(used));
  if (ans) {
    for (int i = 1; i <= n; i++)
      if (was[i]) used[i] = 1;
    for (int i = 1; i <= n; i++)
      if (was[i]) {
        for (int j = 0; j < g[i].size(); j++)
          if (!used[g[i][j]]) dfs2(g[i][j], 0);
      }
    cout << ans + mx << endl;
  } else {
    dfs2(second, 0);
    cout << mx;
  }
}
