#include <bits/stdc++.h>
using namespace std;
const int OO = 1e9;
const double EPS = 1e-9;
template <class T>
void _db(const char* dbStr, T e) {
  cout << dbStr << " = " << e << endl;
}
template <class T, class... L>
void _db(const char* dbStr, T e, L... r) {
  while (*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ',';
  _db(dbStr + 1, r...);
}
template <class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
  o << "[";
  int i = 0;
  for (const pair<S, T>& pr : v)
    o << (!i++ ? "" : ", ") << "{" << pr.first << " : " << pr.second << "}";
  return o << "]";
}
template <template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
  o << "[";
  int i = 0;
  for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
  return o << "]";
}
template <class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
  return o << "(" << pr.first << ", " << pr.second << ")";
}
ostream& operator<<(ostream& o, const string& s) {
  for (const char& c : s) o << c;
  return o;
}
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
template <class T>
using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;
int n, m, s;
vi w, Sz, mxSz;
vvi adj, bridgeTree;
V<ll> compW, sum;
ll ans, mx;
V<bool> vis;
void dfs(int u, int p) {
  vis[u] = true;
  mxSz[u] = Sz[u];
  sum[u] = compW[u];
  for (auto& v : bridgeTree[u])
    if (!vis[v]) {
      dfs(v, u);
      mxSz[u] = max(mxSz[u], mxSz[v]);
      sum[u] = max(sum[v] + compW[u], sum[u]);
    }
}
struct ArtPointsAndBridges {
  int n, timer;
  vi st, low;
  V<bool> vis, artPoint;
  V<usi> bridges;
  void init() {
    timer = 0;
    st.assign(n + 1, 0);
    low.assign(n + 1, 0);
    vis.assign(n + 1, 0);
  }
  ArtPointsAndBridges(int _n) : n(_n) {}
  void findArtPoints() {
    init();
    artPoint.assign(n + 1, 0);
    for (int i = 1; i <= n; ++i)
      if (!vis[i]) dfs(i, -1, 0);
  }
  void findBridges() {
    init();
    bridges.assign(n + 1, usi());
    for (int i = 1; i <= n; ++i) {
      if (!vis[i]) dfs(i, -1, 1);
    }
  }
  void dfs(int u, int p, int type) {
    vis[u] = true;
    st[u] = low[u] = timer++;
    int children = 0;
    for (auto& v : adj[u]) {
      if (v == p) continue;
      if (vis[v])
        low[u] = min(low[u], st[v]);
      else {
        dfs(v, u, type);
        low[u] = min(low[u], low[v]);
        if (!type && low[v] >= st[u] && p != -1) artPoint[u] = true;
        if (type && low[v] > st[u]) bridges[u].insert(v), bridges[v].insert(u);
        ++children;
      }
    }
    if (!type && p == -1 && children > 1) artPoint[u] = true;
  }
};
struct BridgeC {
  int n, id;
  V<usi> bridges;
  vi vis, comp, CCID;
  vvi CC;
  BridgeC(int _n) : n(_n) {
    ArtPointsAndBridges br(n);
    br.findBridges();
    vis.assign(n + 1, 0);
    CCID.assign(n + 1, 0);
    bridges = br.bridges;
    true;
    for (int i = 1; i <= n; ++i)
      if (!vis[i]) {
        comp.clear();
        dfs(i);
        for (auto& u : comp) CCID[u] = int(CC.size());
        CC.push_back(comp);
      }
  }
  void dfs(int u) {
    vis[u] = true;
    comp.push_back(u);
    for (auto& v : adj[u])
      if (!vis[v] && !(bridges[u].find(v) != bridges[u].end())) dfs(v);
  }
};
int main() {
  ios::sync_with_stdio(false);
  cout.precision(10);
  cin.tie(0);
  cin >> n >> m;
  w.assign(n + 1, 0);
  adj.assign(n + 1, vi());
  for (int i = 1; i <= n; ++i) {
    cin >> w[i];
  }
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  BridgeC bc(n);
  bridgeTree.assign(n + 1, vi());
  compW.assign(n + 1, 0);
  Sz.assign(n + 1, 0);
  mxSz.assign(n + 1, 0);
  for (int u = 1; u <= n; ++u) {
    int a = bc.CCID[u];
    ++Sz[a];
    compW[a] += w[u];
    for (auto& v : adj[u]) {
      int b = bc.CCID[v];
      bridgeTree[a].push_back(b);
      bridgeTree[b].push_back(a);
      true;
    }
  }
  true;
  for (int i = 1; i <= n; ++i) {
    true;
  }
  cin >> s;
  s = bc.CCID[s];
  true;
  vis.assign(n + 1, 0);
  sum.assign(n + 1, 0);
  dfs(s, -1);
  ans = compW[s];
  true;
  true;
  for (int i = 0; i <= n; ++i) {
    if (i == s) continue;
    if (mxSz[i] > 1)
      ans += compW[i];
    else
      mx = max(mx, sum[i]);
  }
  cout << ans + mx << '\n';
  return 0;
}
