#include <bits/stdc++.h>
using namespace std;
long long int N, M, used[200005], at;
long long int grp[200005], low[200005], disc[200005];
long long int eksi[200005], val[200005], val2[200005], cnt[200005];
vector<long long int> yol[200005], yol2[200005];
vector<long long int> now;
long long int findlow(long long int x) {
  if (grp[x] == x) return x;
  return grp[x] = findlow(grp[x]);
}
void f(long long int cur, long long int pr) {
  low[cur] = disc[cur] = ++at;
  used[cur] = 1;
  for (long long int i = 0; i < yol[cur].size(); i++) {
    long long int c = yol[cur][i];
    if (c == pr) continue;
    if (disc[c]) {
      if (disc[c] < low[cur]) low[cur] = disc[c], grp[cur] = grp[c];
    } else {
      f(c, cur);
      if (low[c] < low[cur]) {
        low[cur] = low[c], grp[cur] = grp[c];
      }
    }
  }
}
pair<long long int, long long int> dfs(long long int cur, long long int pr) {
  pair<long long int, long long int> ret = make_pair(-1000000007, -1000000007);
  long long int sumret = 0, flag = 0, maxret = 0;
  for (int i = 0; i < yol2[cur].size(); i++)
    if (yol2[cur][i] != pr) {
      pair<long long int, long long int> tmp = dfs(yol2[cur][i], cur);
      if (tmp.first != -1000000007) {
        sumret += tmp.first;
        flag = 1;
      }
      maxret =
          max(maxret, tmp.second - (tmp.first == -1000000007 ? 0 : tmp.first));
    }
  if (!flag && cnt[cur] == 1)
    ret.first = -1000000007;
  else
    ret.first = sumret + val2[cur];
  ret.second = sumret + maxret + val2[cur];
  return ret;
}
int main() {
  long long int a, b;
  cin >> N >> M;
  for (int i = 1; i <= N; i++) scanf("%lld", val + i);
  for (long long int i = 1; i <= M; i++) {
    scanf("%lld %lld", &a, &b);
    yol[a].push_back(b);
    yol[b].push_back(a);
  }
  for (long long int i = 1; i <= N; i++) grp[i] = i;
  for (long long int i = 1; i <= N; i++)
    if (!used[i]) {
      at = 0;
      f(i, 0);
    }
  for (int i = 1; i <= N; i++) {
    val2[findlow(i)] += val[i];
    cnt[findlow(i)]++;
  }
  for (int i = 1; i <= N; i++)
    for (int j = 0; j < yol[i].size(); j++)
      if (findlow(i) < findlow(yol[i][j])) {
        yol2[findlow(i)].push_back(findlow(yol[i][j]));
        yol2[findlow(yol[i][j])].push_back(findlow(i));
      }
  long long int cur;
  scanf("%lld", &cur);
  cur = findlow(cur);
  pair<long long int, long long int> ans = dfs(cur, 0);
  cout << max(ans.first, ans.second) << endl;
  return 0;
}
