#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const long long int P = 1000000007;
const double eps = 1e-6;
int val[N];
int deg[N];
vector<int> gr[N];
vector<long long int> mx(N);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> val[i];
    ans += val[i];
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    gr[u].push_back(v);
    gr[v].push_back(u);
    deg[u]++, deg[v]++;
  }
  int start;
  cin >> start;
  start--;
  stack<int> st;
  for (int i = 0; i < n; i++)
    if (deg[i] == 1 && i != start) st.push(i);
  long long int maxall = 0;
  while (!st.empty()) {
    int now = st.top();
    st.pop();
    deg[now]--;
    ans -= val[now];
    for (auto i : gr[now]) {
      if (deg[i]) {
        deg[i]--;
        if (deg[i] == 1 && i != start) st.push(i);
        mx[i] = max((long long int)mx[i],
                    (long long int)mx[now] + (long long int)val[now]);
        maxall = max(maxall, mx[i]);
      }
    }
  }
  cout << ans + maxall;
  cerr << "\nTime elapsed : " << 1000 * clock() / CLOCKS_PER_SEC << " ms\n";
  return 0;
}
