#include <bits/stdc++.h>
using namespace std;
const int MAXA = 4e5;
int fa[MAXA], tag[MAXA], a[MAXA];
long long ans;
vector<int> v[MAXA];
long long dfs(int x, int father) {
  long long an = 0;
  fa[x] = father;
  for (auto u : v[x])
    if (u != father) {
      if (fa[u]) {
        if (~fa[u]) tag[fa[u]]--;
        tag[x]++;
        continue;
      }
      an = max(an, dfs(u, x));
      tag[x] += tag[u];
    }
  if (tag[x])
    ans = ans + a[x];
  else
    an = an + a[x];
  return an;
}
int main() {
  int n, m, x, y, root;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  scanf("%d", &root);
  printf("%lld", dfs(root, -1) + ans);
}
