#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000 * 1000 * 1000 * 1ll * 1000 * 1000 * 1000;
int n, m;
long long socre[200010];
vector<vector<int> > adjlst;
bool visited[200010];
struct ans {
  long long maxv;
  long long extra;
  bool goback;
};
ans dfs(int cur, int from) {
  visited[cur] = true;
  long long maxv = 0, extra = 0;
  bool goback = false;
  for (int i = 0; i < adjlst[cur].size(); i++) {
    if (!visited[adjlst[cur][i]]) {
      ans curp = dfs(adjlst[cur][i], cur);
      maxv += curp.maxv;
      extra = max(extra, curp.extra);
      goback |= curp.goback;
    } else {
      if (from != adjlst[cur][i]) goback = true;
    }
  }
  if (goback) {
    maxv += socre[cur];
  } else {
    extra += socre[cur];
  }
  ans a = {maxv, extra, goback};
  return a;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> socre[i];
    adjlst.push_back(vector<int>(0, 0));
  }
  int u, v;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    adjlst[u - 1].push_back(v - 1);
    adjlst[v - 1].push_back(u - 1);
  }
  int source;
  cin >> source;
  memset(visited, 0, sizeof(visited));
  ans a = dfs(source - 1, -1);
  cout << (a.maxv + a.extra) << endl;
}
