#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)2e5 + 10;
vector<int> v1[maxn];
long long c[maxn];
long long ans = 0;
bool odw[maxn];
long long additional = 0;
pair<long long, bool> dfs(int v, int p) {
  odw[v] = 1;
  pair<long long, bool> ret = {0, 0};
  long long toAdd = 0;
  for (int i = 0; i < (int)v1[v].size(); i++) {
    int w = v1[v][i];
    if (odw[w] == 0 && w != p) {
      pair<long long, bool> tmp = dfs(w, v);
      if (tmp.second == 0)
        toAdd = max(toAdd, tmp.first);
      else
        ret.second = 1;
    } else if (odw[w] == 1 && w != p)
      ret.second = 1;
  }
  ret.first = toAdd + c[v];
  if (ret.second == 0) additional = max(additional, ret.first);
  if (ret.second) ans += c[v];
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> c[i];
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    v1[a].push_back(b);
    v1[b].push_back(a);
  }
  int s;
  cin >> s;
  dfs(s, -1);
  ans += additional;
  cout << ans;
  return 0;
}
