#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > art_graph_adj[1000000 + 9];
long long color[1000000 + 9];
long long art_ar[1000000 + 9];
long long art_low[1000000 + 9];
long long art_app[1000000 + 9];
long long art_parent[1000000 + 9];
long long articulation_edge_list[1000000 + 9];
long long art_counter;
long long art_root_degree;
long long art_source;
long long NODE_VAL[1000000 + 9], LEFT_NODE[1000000 + 9],
    RIGHT_NODE[1000000 + 9], new_color[1000000 + 9], TTTT[1000000 + 9],
    EEEE[1000000 + 9];
long long art_color[1000000 + 9];
vector<long long> new_adj_list[1000000 + 9];
long long YY, MAIN_ANS_ANS, CURR_POS;
void init_articulation(int n, int m) {
  int i;
  for (i = 0; i <= n + 5; i++) {
    art_graph_adj[i].clear();
    art_color[i] = 0;
    art_parent[i] = 0;
  }
}
void find_articulation(int v) {
  int i, w;
  art_color[v] = 1;
  art_counter++;
  art_ar[v] = art_low[v] = art_counter;
  for (i = 0; i < art_graph_adj[v].size(); i++) {
    w = art_graph_adj[v][i].first;
    if (!art_color[w]) {
      art_parent[w] = v;
      find_articulation(w);
      art_low[v] = min(art_low[v], art_low[w]);
      if (art_low[w] > art_ar[v]) {
        art_app[v]++;
        articulation_edge_list[art_graph_adj[v][i].second] = 1;
      }
    } else if (w != art_parent[v]) {
      art_low[v] = min(art_low[v], art_ar[w]);
    }
  }
}
void DFS(long long curr) {
  long long i, j, k, l, siz;
  color[curr] = YY;
  TTTT[YY] += NODE_VAL[curr];
  EEEE[YY] += 1;
  siz = art_graph_adj[curr].size();
  for (i = 0; i < siz; i++) {
    j = art_graph_adj[curr][i].first;
    k = art_graph_adj[curr][i].second;
    if (articulation_edge_list[k]) continue;
    if (color[j] == 0) DFS(j);
  }
}
pair<pair<long long, long long>, long long> ANOTHER_DFS(long long curr) {
  long long i, j, k, l, siz, ans, temp;
  pair<pair<long long, long long>, long long> RET_TUPLE, TEMP_TUPLE;
  new_color[curr] = 1;
  siz = new_adj_list[curr].size();
  RET_TUPLE.second = (EEEE[curr] > 1);
  RET_TUPLE.first.first = 0;
  RET_TUPLE.first.second = 0;
  for (i = 0; i < siz; i++) {
    j = new_adj_list[curr][i];
    if (new_color[j] == 0) {
      TEMP_TUPLE = ANOTHER_DFS(j);
      RET_TUPLE.second |= TEMP_TUPLE.second;
      RET_TUPLE.first.first += TEMP_TUPLE.first.first;
      RET_TUPLE.first.second =
          max(RET_TUPLE.first.second, TEMP_TUPLE.first.second);
    }
  }
  if (RET_TUPLE.second == 0)
    RET_TUPLE.first.second += TTTT[curr];
  else
    RET_TUPLE.first.first += TTTT[curr];
  return RET_TUPLE;
}
int main() {
  long long i, j, k, l, n, m, curr_pos, ans;
  cin >> n >> m;
  init_articulation(n, m);
  for (i = 1; i <= n; i++) scanf("%lld", &NODE_VAL[i]);
  for (i = 1; i <= m; i++) {
    scanf("%lld%lld", &j, &k);
    art_graph_adj[j].push_back(make_pair(k, i));
    art_graph_adj[k].push_back(make_pair(j, i));
    LEFT_NODE[i] = j;
    RIGHT_NODE[i] = k;
  }
  cin >> curr_pos;
  for (i = 1; i <= n; i++) {
    if (color[i] == 0) {
      art_counter = 0;
      art_source = i;
      art_root_degree = art_graph_adj[art_source].size();
      find_articulation(art_source);
      if (art_root_degree > 1) {
        art_app[art_source] = 1;
      }
    }
  }
  memset(color, 0, sizeof(color));
  YY = 0;
  for (i = 1; i <= n; i++) {
    if (color[i] == 0) {
      YY++;
      DFS(i);
    }
  }
  for (i = 1; i <= m; i++) {
    if (color[LEFT_NODE[i]] == color[RIGHT_NODE[i]]) continue;
    new_adj_list[color[LEFT_NODE[i]]].push_back(color[RIGHT_NODE[i]]);
    new_adj_list[color[RIGHT_NODE[i]]].push_back(color[LEFT_NODE[i]]);
  }
  CURR_POS = color[curr_pos];
  pair<pair<long long, long long>, long long> ANS_TUPLE = ANOTHER_DFS(CURR_POS);
  cout << ANS_TUPLE.first.first + ANS_TUPLE.first.second << endl;
}
