#include <bits/stdc++.h>
using namespace std;
int n, m;
int dfn[200010], low[200010], id;
long long f[200010], sum[200010];
int w[200010];
bool can[200010];
struct Edge {
  int to, next;
} es[400010];
int first[200010], te = 0;
void addE(int a, int b) {
  te++;
  es[te].to = b;
  es[te].next = first[a];
  first[a] = te;
}
void dfs(int p, int fa) {
  dfn[p] = low[p] = ++id;
  long long mx = 0;
  for (int e = first[p]; e; e = es[e].next) {
    int to = es[e].to;
    if (to == fa) continue;
    if (dfn[to])
      low[p] = min(low[p], dfn[to]);
    else {
      dfs(to, p);
      low[p] = min(low[p], low[to]);
      sum[p] += sum[to];
      mx = max(mx, f[to] - sum[to]);
      can[p] |= can[to];
    }
  }
  if (low[p] < dfn[p]) can[p] = true;
  f[p] = sum[p] + mx + w[p];
  if (sum[p] > 0 || can[p]) sum[p] += w[p];
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    addE(u, v), addE(v, u);
  }
  int s;
  cin >> s;
  dfs(s, 0);
  cout << f[s] << endl;
  return 0;
}
