#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int Maxn = 2e5 + 10;
bool vis[Maxn], u[Maxn];
int n, m, head[Maxn], ver[2 * Maxn], nxt[2 * Maxn], cnt;
long long ans, dp[Maxn], v[Maxn];
void addedge(int x, int y) {
  cnt++, ver[cnt] = y, nxt[cnt] = head[x], head[x] = cnt;
}
void dfs(int x, int fa) {
  vis[x] = 1;
  for (int i = head[x]; i; i = nxt[i]) {
    if (ver[i] != fa) {
      if (vis[ver[i]])
        u[x] = 1;
      else {
        dfs(ver[i], x);
        if (u[ver[i]]) {
          u[x] = 1;
        }
        dp[x] = max(dp[ver[i]], dp[x]);
      }
    }
  }
  if (u[x])
    ans += v[x];
  else
    dp[x] += v[x];
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &v[i]);
  for (int j = 1; j <= m; j++) {
    int x, y;
    scanf("%d %d", &x, &y);
    addedge(x, y);
    addedge(y, x);
  }
  int s;
  scanf("%d", &s);
  dfs(s, 0);
  cout << ans + dp[s] << endl;
}
