#include <bits/stdc++.h>
using namespace std;
queue<int> q;
stack<int> sta;
vector<int> edge[200005];
long long n, m, s[200005], F[200005], sum, maxa, point, x, y, deg[200005], t;
bool f[200005];
bool dfs1(int x, int y) {
  if (!f[x]) return true;
  int len = edge[x].size();
  for (int i = 0; i < len; i++) {
    if (edge[x][i] == y) continue;
    bool useless = dfs1(edge[x][i], x);
    if (useless) {
      sta.push(edge[x][i]);
      return true;
    }
  }
  return false;
}
void dfs2(int x) {
  if (f[x]) return;
  if (s[x] == -1) return;
  sum += s[x];
  maxa = max(maxa, F[x]);
  s[x] = -1;
  int len = edge[x].size();
  for (int i = 0; i < len; i++) dfs2(edge[x][i]);
  return;
}
void dfs(int x, int y) {
  F[x] = s[x];
  int len = edge[x].size();
  for (int i = 0; i < len; i++) {
    if (edge[x][i] == y) continue;
    dfs(edge[x][i], x);
    F[x] = max(F[x], F[edge[x][i]] + s[x]);
  }
  return;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) scanf("%d", &s[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    edge[x].push_back(y);
    edge[y].push_back(x);
    deg[x]++;
    deg[y]++;
  }
  for (int i = 1; i <= n; i++)
    if (deg[i] == 1) q.push(i);
  while (!q.empty()) {
    x = q.front();
    q.pop();
    f[x] = true;
    int len = edge[x].size();
    for (int i = 0; i < len; i++) {
      if (f[edge[x][i]]) continue;
      F[edge[x][i]] = max(F[edge[x][i]], F[x] + s[x]);
      deg[edge[x][i]]--;
      deg[x]--;
      if (deg[edge[x][i]] == 1) q.push(edge[x][i]);
    }
  }
  bool flag = false;
  cin >> t;
  for (int i = 1; i <= n; i++)
    if (!f[i]) flag = true;
  if (!flag) {
    dfs(t, t);
    cout << F[t];
    return 0;
  }
  bool useless = dfs1(t, t);
  point = t;
  while (!sta.empty()) {
    F[point] = 0;
    sum += s[point];
    s[point] = 0;
    int len = edge[point].size();
    for (int i = 0; i < len; i++) {
      if (edge[point][i] == sta.top()) continue;
      F[point] = max(F[point], F[edge[point][i]] + s[edge[point][i]]);
    }
    point = sta.top();
    sta.pop();
  }
  int len = edge[point].size();
  F[point] = 0;
  for (int i = 0; i < len; i++)
    if (f[edge[point][i]])
      F[point] = max(F[point], F[edge[point][i]] + s[edge[point][i]]);
  dfs2(point);
  cout << sum + maxa;
  return 0;
}
