#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 99;
long long n, m, w[N], e = 1e6, cnt = 1, dp[N], dp1[N], mark[N], ans, mx, x, y,
                      s;
vector<long long> g[N];
map<long long, long long> brshi;
void dfs(int x, int par) {
  mark[x] = 1;
  dp[x] = w[x];
  long long p = 0;
  for (long long i = 0; i < g[x].size(); i++) {
    if (g[x][i] != par && mark[g[x][i]] == 1) dp1[x] = 1;
  }
  for (long long i = 0; i < g[x].size(); i++) {
    if (mark[g[x][i]] == 0) {
      dfs(g[x][i], x);
      dp1[x] += dp1[g[x][i]];
      p = max(p, dp[g[x][i]]);
      ;
    }
  }
  dp[x] += p;
  if (dp1[x] == 0) {
    ans -= w[x];
    mx = max(mx, dp[x]);
    ;
  }
}
int main() {
  cin >> n >> m;
  for (long long i = 1; i < n + 1; i++) {
    scanf("%I64d", &w[i]);
    ;
    ans += w[i];
  }
  for (long long i = 0; i < m; i++) {
    scanf("%I64d%I64d", &x, &y);
    ;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  cin >> s;
  dfs(s, 0);
  cout << ans + mx;
}
