#include <bits/stdc++.h>
using namespace std;
struct node {
  bool flag = 0;
  long long sum1 = 0, sum2 = 0;
  void operator+=(const node& rhs) {
    flag |= rhs.flag;
    sum1 += rhs.sum1;
    sum2 = max(sum2, rhs.sum2);
  }
};
const int N = 200200;
int n, m, s, T;
int par[N], siz[N];
int tin[N], low[N];
long long a[N];
vector<int> edges[N], tree[N];
vector<pair<int, int>> bridges;
int findSetId(int u) { return (par[u] == u ? u : par[u] = findSetId(par[u])); }
void findBridges(int u = 1, int p = -1) {
  tin[u] = low[u] = ++T;
  for (int v : edges[u]) {
    if (v == p) {
      continue;
    }
    if (tin[v] == 0) {
      findBridges(v, u);
      if (low[v] > tin[u]) {
        bridges.push_back({u, v});
      } else {
        int x = findSetId(u);
        int y = findSetId(v);
        if (x != y) {
          par[y] = x;
          siz[x] += siz[y];
          a[x] += a[y];
        }
      }
    }
    low[u] = min(low[u], low[v]);
  }
}
void buildBridgeTree() {
  for (int i = 1; i <= n; ++i) {
    par[i] = i, siz[i] = 1;
  }
  findBridges();
  for (auto& b : bridges) {
    int u = findSetId(b.first);
    int v = findSetId(b.second);
    tree[u].push_back(v);
    tree[v].push_back(u);
  }
}
node solve(int u = s, int p = -1) {
  node ret;
  for (int v : tree[u]) {
    if (v == p) {
      continue;
    }
    ret += solve(v, u);
  }
  if (siz[u] > 1 || ret.flag) {
    ret.sum1 += a[u], ret.flag = 1;
  } else {
    ret.sum2 += a[u];
  }
  return ret;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", a + i);
  }
  while (m--) {
    int u, v;
    scanf("%d %d", &u, &v);
    edges[u].push_back(v);
    edges[v].push_back(u);
  }
  cin >> s;
  buildBridgeTree();
  auto out = solve(findSetId(s));
  cout << out.sum1 + out.sum2;
  return 0;
}
