#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 3;
vector<int> v[MAXN];
long long cst[MAXN];
bool odw[MAXN];
long long mx = 0;
long long temp, pos;
pair<bool, long long> DFS(int x, long long k, int sk) {
  pair<bool, long long> p;
  pair<bool, long long> ret = {false, 0};
  odw[x] = true;
  temp += cst[x];
  for (auto it : v[x]) {
    if (odw[it]) {
      if (it != sk) ret.first = true;
      continue;
    }
    p = DFS(it, k, x);
    if (p.first)
      ret.first = true;
    else
      ret.second = max(ret.second, p.second);
  }
  if (ret.first)
    ret.second = 0LL;
  else {
    ret.second += cst[x];
    pos = max(pos, ret.second);
    temp -= cst[x];
  }
  return ret;
}
int main() {
  int n, m;
  int x, y;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%lld", &cst[i]);
  while (m--) {
    scanf("%d %d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  scanf("%d", &x);
  odw[x] = true;
  temp = cst[x];
  for (auto it : v[x]) {
    if (!odw[it]) {
      pos = 0;
      DFS(it, cst[x], x);
      mx = max(mx, pos);
    }
  }
  printf("%lld", mx + temp);
  return 0;
}
