#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
long long a[N], b[N], dp[N], deg[N];
vector<int> e[N];
queue<int> q;
int main() {
  long long n, m, u, v, s, ans1 = 0, ans2 = 0;
  scanf("%lld%lld", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]), dp[i] = a[i];
  for (int i = 1; i <= m; i++)
    scanf("%lld%lld", &u, &v), e[u].push_back(v), e[v].push_back(u), deg[u]++,
        deg[v]++;
  scanf("%lld", &s), deg[s] = 1e18;
  for (int i = 1; i <= n; i++)
    if (deg[i] == 1) q.push(i);
  while (!q.empty()) {
    u = q.front();
    q.pop();
    for (auto v : e[u]) {
      if (!deg[v]) continue;
      dp[v] = max(dp[u] + a[v], dp[v]), deg[v]--;
      if (deg[v] == 1) q.push(v);
    }
    deg[u] = 0;
  }
  for (int i = 1; i <= n; i++) {
    if (deg[i] != 0)
      ans1 += a[i];
    else
      ans2 = max(ans2, dp[i]);
  }
  printf("%lld\n", ans1 + ans2);
  return 0;
}
