#include <bits/stdc++.h>
using namespace std;
const int _ = 1e2;
const int maxn = 2e5 + _;
struct node {
  int y, next;
} a[2 * maxn];
int len, last[maxn];
void ins(int x, int y) {
  a[++len].y = y;
  a[len].next = last[x];
  last[x] = len;
}
int c[maxn];
long long s[maxn];
bool v[maxn], t[maxn];
void dfs(int x, int fr) {
  v[x] = true;
  for (int k = last[x]; k; k = a[k].next) {
    int y = a[k].y;
    if (y != fr) {
      if (v[y])
        t[x] = true;
      else
        dfs(y, x), t[x] |= t[y];
    }
  }
  if (!t[x]) {
    for (int k = last[x]; k; k = a[k].next)
      if (a[k].y != fr) s[x] = max(s[x], s[a[k].y]);
    s[x] += c[x];
  }
}
int main() {
  int n, m, x, y;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    ins(x, y), ins(y, x);
  }
  int st;
  scanf("%d", &st);
  dfs(st, 0);
  long long ans = 0, mx = 0;
  for (int i = 1; i <= n; i++)
    if (t[i])
      ans += c[i];
    else
      mx = max(s[i], mx);
  printf("%lld\n", ans + mx);
  return 0;
}
