#include <bits/stdc++.h>
using namespace std;
long long n, m, w[200010], start;
vector<long long> g[200010], t[200010];
long long p[200010];
long long nz[200010], pma[200010];
bool used[200010];
long long dfs(long long x, long long from) {
  long long ma = 0;
  for (auto y : g[x])
    if (y != from) {
      ma = max(ma, dfs(y, x));
    }
  ma += w[x];
  return ma;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
    used[i] = 0;
    p[i] = -1;
  }
  for (int i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  cin >> start;
  if (n - 1 == m) {
    cout << dfs(start, -1) << endl;
    return 0;
  }
  queue<long long> Q;
  for (int i = 1; i <= n; i++) {
    nz[i] = g[i].size();
    if (nz[i] == 1) Q.push(i);
  }
  while (!Q.empty()) {
    long long x = Q.front();
    Q.pop();
    used[x] = 1;
    pma[x] = 0;
    for (auto y : g[x]) {
      nz[y]--;
      if (nz[y] == 1) {
        Q.push(y);
      }
      if (nz[y] == 0) {
        pma[x] = max(pma[x], pma[y]);
        p[y] = x;
        t[x].push_back(y);
      }
    }
    pma[x] += w[x];
  }
  w[0] = 0;
  for (int i = 1; i <= n; i++) {
    if (used[i] == 0) {
      w[0] += w[i];
    }
  }
  if (used[start] == 0) {
    long long ans = w[0];
    for (int i = 1; i <= n; i++) {
      if (used[i]) ans = max(ans, w[0] + pma[i]);
    }
    cout << ans << endl;
  } else {
    long long ans = pma[start];
    long long sum = w[0];
    long long ma = 0;
    long long bef = -1;
    while (1) {
      sum += w[start];
      for (auto x : t[start]) {
        if (x != bef) ma = max(ma, pma[x]);
      }
      bef = start;
      if (p[start] == -1) break;
      start = p[start];
    }
    for (int i = 1; i <= n; i++) {
      if (used[i] && p[i] == -1 && i != start) {
        ma = max(ma, pma[i]);
      }
    }
    sum += ma;
    ans = max(ans, sum);
    cout << ans << endl;
  }
  return 0;
}
