#include <bits/stdc++.h>
#pragma GCC optimize "03"
using namespace std;
const long long int N = 2e5 + 5;
const long long int mod = 1e9 + 7;
const long long int inf = 1e18 + 9;
long long int s, ans, a[N], deg[N], in[N], vis[N];
vector<long long int> g[N];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, m;
  cin >> n >> m;
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long int i = 1; i <= m; i++) {
    long long int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
    deg[u]++;
    deg[v]++;
  }
  cin >> s;
  long long int mx = 0;
  queue<long long int> q;
  for (long long int i = 1; i <= n; i++) {
    if (g[i].size() == 1 && i != s) {
      q.push(i);
    }
  }
  while (!q.empty()) {
    long long int x = q.front();
    q.pop();
    in[x] += a[x];
    vis[x] = 1;
    for (auto i : g[x]) {
      deg[i]--;
      if (deg[i] <= 0) continue;
      in[i] = max(in[i], in[x]);
      if (deg[i] == 1 && i != s) q.push(i);
    }
  }
  for (long long int i = 1; i <= n; i++) {
    if (!vis[i])
      ans += a[i];
    else {
      mx = max(mx, in[i]);
    }
  }
  cout << ans + mx;
  return 0;
}
