#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793238460;
using namespace std;
const int N = 200200;
vector<int> g[N];
int w[N], vis[N], done[N];
int can_back[N];
int n, m, s;
long long maximum = 0;
void dfs(int u, int par) {
  vis[u] = 1;
  for (auto v : g[u]) {
    if (v == par) continue;
    if (vis[v])
      can_back[v] = 1;
    else
      dfs(v, u);
    if (can_back[v] == 1) can_back[u] = 1;
  }
}
void findmax(int u, long long sum) {
  done[u] = 1;
  if (g[u].size() == 1 and u != s) {
    sum += w[u];
    maximum = max(maximum, sum);
    return;
  }
  if (can_back[u] == 0) sum += w[u];
  for (auto v : g[u]) {
    if (!done[v]) findmax(v, sum);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  cin >> s;
  can_back[s] = 1;
  dfs(s, 0);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (can_back[i] == 1) ans += w[i];
  }
  findmax(s, 0);
  ans += maximum;
  cout << ans;
  return 0;
}
