#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <typename T1, typename T2>
inline void chkmin(T1 &first, T2 second) {
  if (first > second) first = second;
}
template <typename T1, typename T2>
inline void chkmax(T1 &first, T2 second) {
  if (first < second) first = second;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const pair<T, U> &_p) {
  _out << _p.first << ' ' << _p.second;
  return _out;
}
template <typename T, typename U>
inline istream &operator>>(istream &_in, pair<T, U> &_p) {
  _in >> _p.first >> _p.second;
  return _in;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const vector<T> &_v) {
  if (_v.empty()) {
    return _out;
  }
  _out << _v.front();
  for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline istream &operator>>(istream &_in, vector<T> &_v) {
  for (auto &_i : _v) {
    _in >> _i;
  }
  return _in;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const set<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const multiset<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const unordered_set<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const unordered_multiset<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const map<T, U> &_m) {
  if (_m.empty()) {
    return _out;
  }
  _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')';
  for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) {
    _out << ", (" << _it->first << ": " << _it->second << ')';
  }
  return _out;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const unordered_map<T, U> &_m) {
  if (_m.empty()) {
    return _out;
  }
  _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')';
  for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) {
    _out << ", (" << _it->first << ": " << _it->second << ')';
  }
  return _out;
}
const int N = 3e5 + 5;
int n, m;
bool bad[N];
long long cost[N], w[N];
vector<int> edge[N];
long long ans = 0;
int px[N];
queue<int> dead;
long long mod = 0;
long long dfs(int i, int p = -1) {
  if (!bad[i]) return 0;
  long long ans = 0;
  for (int j : edge[i]) {
    if (j == p) continue;
    chkmax(ans, dfs(j, i));
  }
  return ans + w[i];
}
int s;
void dfs2(int i, int p = -1, long long sum = 0, long long need = 0) {
  if (!bad[i]) {
    vector<long long> best = {0};
    for (int j = 0; j < n; ++j) {
      if (bad[j]) continue;
      for (int q : edge[j]) {
        if (q == p || !bad[q]) continue;
        best.push_back(cost[q]);
      }
    }
    best.push_back(need);
    chkmax(ans, mod + sum + *max_element(best.begin(), best.end()));
    return;
    ;
  }
  sum += w[i];
  if (i == s) {
    need = cost[s] - w[s];
  }
  vector<long long> best;
  for (int q : edge[i]) {
    if (q == p || !bad[q]) continue;
    best.push_back(cost[q]);
  }
  sort(best.rbegin(), best.rend());
  chkmax(ans, sum);
  best.push_back(0);
  best.push_back(0);
  for (int j : edge[i]) {
    if (j == p) continue;
    if (best[0] == cost[j]) {
      dfs2(j, i, sum, max(need, best[1]));
    } else {
      dfs2(j, i, sum, max(need, best[0]));
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  srand(time(0));
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> w[i];
    mod += w[i];
    cost[i] = -1e18;
  }
  if (n == 1) {
    cout << w[0] << '\n';
    return 0;
  }
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  for (int i = 0; i < n; ++i) {
    px[i] = edge[i].size();
    if (px[i] == 1) {
      dead.push(i);
      px[i] = -1;
      bad[i] = true;
    }
  }
  cin >> s;
  --s;
  vector<long long> res;
  while (dead.size()) {
    int u = dead.front();
    mod -= w[u];
    dead.pop();
    vector<long long> best;
    for (int v : edge[u]) {
      if (bad[v]) {
        best.push_back(cost[v]);
      }
    }
    sort(best.rbegin(), best.rend());
    cost[u] = w[u];
    if (best.size()) {
      cost[u] += best[0];
    }
    res.push_back(cost[u]);
    chkmax(ans, cost[u]);
    for (int v : edge[u]) {
      --px[v];
      if (px[v] == 0 || px[v] == 1) {
        dead.push(v);
        px[v] = -1;
        bad[v] = true;
      }
    }
  }
  if (!bad[s]) {
    sort(res.rbegin(), res.rend());
    chkmax(ans, mod);
    if (res.size()) {
      chkmax(ans, mod + res[0]);
    }
    cout << ans << '\n';
    return 0;
  }
  dfs2(s);
  cout << ans << '\n';
}
