#include <bits/stdc++.h>
using namespace std;
int dset[222222];
int fa(int a) {
  if (dset[a] != a) return dset[a] = fa(dset[a]);
  return a;
}
vector<int> e[222222];
int deg[222222], type[222222];
int q[222222], top, front;
long long w[222222], maxnum[222222];
int main() {
  int n, m, a, b;
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n + 1; i++) scanf("%I64d", &w[i]);
  for (int i = 1; i < m + 1; i++)
    scanf("%d%d", &a, &b), e[a].push_back(b), e[b].push_back(a), deg[a]++,
        deg[b]++;
  int s;
  scanf("%d", &s);
  for (int i = 1; i < n + 1; i++)
    if (deg[i] == 1) q[top++] = i;
  while (top != front) {
    int k = q[front++];
    if (k == s) continue;
    type[k] = 1;
    for (int x : e[k])
      if (!type[x]) {
        maxnum[x] = max(maxnum[x], maxnum[k] + w[k]);
        deg[x]--;
        if (deg[x] == 1) q[top++] = x;
      }
  }
  long long res = 0, maxx = 0;
  for (int i = 1; i < n + 1; i++)
    if (!type[i]) res += w[i], maxx = max(maxx, maxnum[i]);
  printf("%I64d\n", maxx + res);
}
