#include <bits/stdc++.h>
using namespace std;
vector<vector<long long> > g;
long long vis[200005], w[200005];
long long cycle[200005];
long long taken[200005];
long long s;
void dfs(long long x, long long par) {
  vis[x] = 1;
  for (long long i = 0; i < g[x].size(); i++) {
    long long y = g[x][i];
    if (y == par) continue;
    if (vis[y] == 1)
      cycle[y] = 1, cycle[x] = 1;
    else if (vis[y] == 0) {
      dfs(y, x);
      if (cycle[y] == 1) cycle[x] = 1;
    }
  }
  vis[x] = 2;
}
long long maxi;
long long dfs2(long long x) {
  vis[x] = 1;
  long long ans = 0, res = 0;
  for (long long i = 0; i < g[x].size(); i++) {
    long long y = g[x][i];
    if (cycle[x] == 1) {
      if (!vis[y]) {
        if (cycle[y])
          ans += dfs2(y);
        else {
          maxi = max(maxi, dfs2(y));
        }
      }
    } else {
      if (!vis[y]) {
        res = max(res, dfs2(y));
      }
    }
  }
  if (x == s - 1) {
    return ans + maxi + w[x];
  }
  if (cycle[x] == 0) ans += res, maxi = max(maxi, ans + w[x]);
  return w[x] + ans;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  long long n, m;
  cin >> n >> m;
  vector<long long> v;
  for (long long i = 0; i < n; i++) g.push_back(v);
  maxi = 0;
  for (long long i = 0; i < n; i++) cin >> w[i];
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    x--, y--;
    g[x].push_back(y), g[y].push_back(x);
  }
  cin >> s;
  dfs(s - 1, -1);
  for (long long i = 0; i < n; i++) vis[i] = 0;
  cout << dfs2(s - 1) << endl;
  return 0;
}
