#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = (int)2e5 + 100;
int a[N];
vector<pair<int, int> > v[N];
bool was[N];
int s;
int tin[N];
int up[N];
int b[N];
stack<int> st;
int gtime = 0;
int gcol = 0;
int coun[N];
void cds(int x, int pr = -1) {
  was[x] = 1;
  tin[x] = up[x] = gtime++;
  int i, y, c, col;
  for ((i) = 0; (i) < (v[x].size()); (i)++) {
    y = v[x][i].first;
    c = v[x][i].second;
    if (y == pr) continue;
    if (!was[y]) {
      st.push(c);
      cds(y, x);
      if (up[y] >= tin[x]) {
        col = gcol++;
        while (st.top() != c) {
          b[st.top()] = col;
          coun[col]++;
          st.pop();
        }
        b[c] = col;
        coun[col]++;
        st.pop();
      }
      if (up[y] < up[x]) {
        up[x] = up[y];
      }
    } else {
      if (tin[y] < tin[x]) {
        st.push(c);
      }
      if (up[x] > tin[y]) {
        up[x] = up[y];
      }
    }
  }
}
long long ans = 0;
void dfs2(int x, int z) {
  if (!was[x]) ans += a[x];
  was[x] = 1;
  int i;
  for ((i) = 0; (i) < (v[x].size()); (i)++) {
    if (b[v[x][i].second] == z && !was[v[x][i].first]) {
      dfs2(v[x][i].first, z);
    }
  }
}
void dfs(int x) {
  int i;
  map<int, int> m;
  for ((i) = 0; (i) < (v[x].size()); (i)++) {
    m[b[v[x][i].second]]++;
  }
  for (auto j : m) {
    if (j.second > 1) {
      dfs2(x, j.first);
    }
  }
}
int dfs3(int x, int col, int pr = -1) {
  if (was[x] && pr != -1) return 1;
  int i, y, o = 0, c, ma = 0;
  for ((i) = 0; (i) < (v[x].size()); (i)++) {
    y = v[x][i].first;
    c = v[x][i].second;
    if (b[c] == col) continue;
    if (y == pr) continue;
    o = dfs3(y, col, x);
    if (o) {
      b[c] = col;
      if (!was[x]) ans += a[x];
      was[x] = 1;
    }
    ma = max(ma, o);
  }
  return ma;
}
long long dfstree(int x, int pr = -1) {
  int i, y;
  long long o = 0;
  for ((i) = 0; (i) < (v[x].size()); (i)++) {
    y = v[x][i].first;
    if (y == pr) continue;
    o = max(o, dfstree(y, x));
  }
  o += a[x];
  return o;
}
long long dfs4(int x, int col, int pr = -1) {
  int i, y, c;
  long long o = 0;
  for ((i) = 0; (i) < (v[x].size()); (i)++) {
    y = v[x][i].first;
    c = v[x][i].second;
    if (y == pr || b[c] == col) continue;
    o = max(o, dfs4(y, col, x));
  }
  o += a[x];
  return o;
}
bool dfs5(int x, int col, int pr = -1) {
  int i, y, c;
  bool d = 0, dd;
  if (x == s) {
    if (!was[x]) {
      ans += a[x];
      was[x] = 1;
    }
    return 1;
  }
  for ((i) = 0; (i) < (v[x].size()); (i)++) {
    y = v[x][i].first;
    c = v[x][i].second;
    if (y == pr || b[c] == col) continue;
    dd = dfs5(y, col, x);
    if (dd) b[c] = col;
    d = max(d, dd);
  }
  if (d && !was[x]) {
    ans += a[x];
    was[x] = 1;
  }
  return d;
}
int main() {
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  srand(time(0));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  int i, q, w;
  for ((i) = 0; (i) < (n); (i)++) {
    cin >> a[i];
  }
  for ((i) = 0; (i) < (m); (i)++) {
    cin >> q >> w;
    q--;
    w--;
    v[q].push_back({w, i});
    v[w].push_back({q, i});
  }
  cin >> s;
  s--;
  for ((i) = 0; (i) < (n); (i)++) {
    if (!was[i]) {
      gtime = 0;
      gcol++;
      cds(i, -1);
    }
  }
  for ((i) = 0; (i) < (gcol); (i)++) {
    if (coun[i] > 1) {
      break;
    }
  }
  if (i == gcol) {
    cout << dfstree(s);
    return 0;
  }
  int col = i;
  for ((i) = 0; (i) < (m); (i)++) {
    if (coun[b[i]] > 1) b[i] = col;
  }
  memset(was, 0, sizeof(was));
  for ((i) = 0; (i) < (n); (i)++) {
    if (!was[i]) {
      dfs(i);
    }
  }
  for ((i) = 0; (i) < (n); (i)++) {
    if (was[i]) dfs3(i, col);
  }
  if (!was[s]) {
    for ((i) = 0; (i) < (n); (i)++) {
      if (was[i]) {
        dfs5(i, col);
      }
    }
  }
  long long t = 0;
  for ((i) = 0; (i) < (n); (i)++) {
    if (was[i]) t = max(t, dfs4(i, col) - a[i]);
  }
  cout << ans + t;
}
