#include <bits/stdc++.h>
using namespace std;
inline int add(int a, int b) {
  a += b;
  return a >= 1000000007 ? a - 1000000007 : a;
}
inline int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + 1000000007 : a;
}
inline int mul(int a, int b) { return (long long int)a * b % 1000000007; }
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool Cheek(int N, int pos) { return (bool)(N & (1 << pos)); }
int vis[200005], wt[200005], par[200005];
vector<int> graph[200005];
void DFS(int u, int parent) {
  vis[u] = 1;
  par[u] = parent;
  for (int i = 0; i < (int)graph[u].size(); i++) {
    int v = graph[u][i];
    if (vis[v] == 1 && v != parent && vis[u] != 2) vis[v] = 2;
    if (vis[v] == 0) DFS(v, u);
    if (vis[v] == 2 && v != parent) vis[u] = 2;
  }
}
long long int dp[200005];
void DFS2(int u) {
  vis[u] = 1;
  long long int mx = 0;
  for (int i = 0; i < (int)graph[u].size(); i++) {
    int v = graph[u][i];
    if (!vis[v]) {
      DFS2(v);
      mx = max(mx, dp[v]);
    }
  }
  dp[u] = wt[u] + mx;
}
void Solve(int t) {
  int i, j, k, n, m, u, v, start;
  long long int ans = 0LL, must = 0LL;
  scanf("%d %d", &(n), &(m));
  for (__typeof(i) i = 1; i <= n; i++) scanf("%d", &(wt[i]));
  for (i = 1; i <= m; i++) {
    scanf("%d %d", &(u), &(v));
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  scanf("%d", &(start));
  DFS(start, -1);
  for (i = 1; i <= n; i++) {
    if (vis[i] == 2) must += wt[i], wt[i] = 0;
    vis[i] = 0;
  }
  DFS2(start);
  for (i = 1; i <= n; i++) ans = max(ans, dp[i]);
  ans += must;
  cout << ans << endl;
}
int main() {
  int t, T;
  T = 1;
  for (__typeof(t) t = 1; t <= T; t++) {
    Solve(t);
  }
  return 0;
}
