#include <bits/stdc++.h>
using namespace std;
int n, m, s;
long long w[500500], e[500500];
bool visited[500500];
set<int> g[500500];
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> w[i];
  for (int i = 1; i <= m; ++i) {
    int a, b;
    cin >> a >> b;
    g[a].insert(b);
    g[b].insert(a);
  }
  cin >> s;
  vector<int> leafs;
  for (int i = 1; i <= n; ++i)
    if ((int)g[i].size() == 1 && i != s) {
      leafs.push_back(i);
      e[i] = w[i];
    }
  while (!leafs.empty()) {
    int v = leafs.back();
    visited[v] = 1;
    leafs.pop_back();
    int u = *g[v].begin();
    g[u].erase(v);
    e[u] = max(e[u], e[v] + w[u]);
    if ((int)g[u].size() == 1 && u != s) leafs.push_back(u);
  }
  long long ans = 0, mx = 0;
  for (int i = 1; i <= n; ++i) {
    if (!visited[i])
      ans += w[i];
    else
      mx = max(mx, e[i]);
  }
  ans += mx;
  cout << ans << "\n";
  return 0;
}
