#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 1001;
vector<vector<int> > edges;
bool visited[200002];
bool canGoBack[200002];
long long scroe[200002];
int s;
void dfs1(int node, int parent) {
  visited[node] = 1;
  bool cc = false;
  for (auto child : edges[node]) {
    if (child != parent and visited[child]) {
      cc = true;
    }
    if (!visited[child]) {
      dfs1(child, node);
      if (canGoBack[child]) {
        cc = true;
      }
    }
  }
  canGoBack[node] = cc;
}
long long dfs2(int node) {
  visited[node] = 1;
  long long ans = 0;
  for (auto child : edges[node]) {
    if (!visited[child]) {
      ans = max(ans, dfs2(child));
    }
  }
  if (!canGoBack[node]) {
    ans += scroe[node];
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> scroe[i + 1];
  edges.resize(n + 1);
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    edges[u].push_back(v);
    edges[v].push_back(u);
  }
  cin >> s;
  long long val = 0;
  memset(visited, 0, sizeof visited);
  memset(canGoBack, 0, sizeof canGoBack);
  visited[s] = true;
  canGoBack[s] = true;
  for (int i = 0; i < edges[s].size(); ++i) {
    if (visited[edges[s][i]]) continue;
    dfs1(edges[s][i], s);
  }
  for (int i = 1; i <= n; ++i) {
    if (canGoBack[i] or i == s) {
      val += scroe[i];
    }
  }
  memset(visited, 0, sizeof visited);
  long long ex = dfs2(s);
  val += ex;
  cout << val << "\n";
}
