#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
template <class T, class U>
inline void add_self(T &a, U b) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
}
template <class T, class U>
inline void min_self(T &x, U y) {
  if (y < x) x = y;
}
template <class T, class U>
inline void max_self(T &x, U y) {
  if (y > x) x = y;
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  cout << t;
  ;
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
template <class T, class U>
void print_m(const map<T, U> &m, int w = 3) {
  if (m.empty()) {
    cout << "Empty" << endl;
    return;
  }
  for (auto x : m) cout << "(" << x.first << ": " << x.second << ")," << endl;
  cout << endl;
}
template <class T, class U>
void debp(const pair<T, U> &pr, bool end_line = 1) {
  cout << "{" << pr.first << " " << pr.second << "}";
  cout << (end_line ? "\n" : ", ");
}
template <class T>
void print_vp(const T &vp, int sep_line = 0) {
  if (vp.empty()) {
    cout << "Empty" << endl;
    return;
  }
  if (!sep_line) cout << "{ ";
  for (auto x : vp) debp(x, sep_line);
  if (!sep_line) cout << "}\n";
  cout << endl;
}
template <typename T>
void print(const T &v, bool show_index = false) {
  int w = 2;
  if (show_index) {
    for (int i = 0; i < int((v).size()); i++) cout << setw(w) << i << " ";
    cout << endl;
  }
  for (auto &el : v) cout << setw(w) << el << " ";
  cout << endl;
}
template <typename T>
void print_vv(const T &vv) {
  if (int((vv).size()) == 0) {
    cout << "Empty" << endl;
    return;
  }
  int w = 3;
  cout << setw(w) << " ";
  for (int j = 0; j < int((*vv.begin()).size()); j++)
    cout << setw(w) << j << " ";
  cout << endl;
  int i = 0;
  for (auto &v : vv) {
    cout << i++ << " {";
    for (auto &el : v) cout << setw(w) << el << " ";
    cout << "},\n";
  }
  cout << endl;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  print(v);
  return os;
};
template <typename T>
ostream &operator<<(ostream &os, const vector<vector<T>> &vv) {
  print_vv(vv);
  return os;
};
template <class T, class U>
ostream &operator<<(ostream &os, const map<T, U> &m) {
  print_m(m);
  return os;
};
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &pr) {
  debp(pr);
  return os;
};
template <class T, class U>
ostream &operator<<(ostream &os, const vector<pair<T, U>> &vp) {
  print_vp(vp);
  return os;
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  while (cin >> n >> m) {
    vector<long long> ws(n + 1);
    for (int i = int(1); i < int(n + 1); i++) cin >> ws[i];
    vector<vector<int>> adj(n + 1);
    vector<int> deg(n + 1);
    for (int i = 0; i < int(m); i++) {
      int x, y;
      cin >> x >> y;
      adj[x].push_back(y);
      adj[y].push_back(x);
      deg[x]++;
      deg[y]++;
    }
    int st;
    cin >> st;
    queue<int> q;
    vector<int> par(n + 1);
    vector<bool> vis(n + 1);
    function<void(int, int)> dfs = [&](int node, int p) {
      vis[node] = 1;
      par[node] = p;
      for (auto ad : adj[node]) {
        if (!vis[ad]) {
          dfs(ad, node);
        }
      }
    };
    dfs(st, 0);
    for (int i = int(1); i < int(n + 1); i++) {
      if (deg[i] == 1 && i != st) {
        q.push(i);
      }
    }
    vector<long long> extra(n + 1);
    while (!q.empty()) {
      auto top = q.front();
      q.pop();
      --deg[top];
      int p = par[top];
      max_self(extra[p], extra[top] + ws[top]);
      if (--deg[p] == 1 && p != st) {
        q.push(p);
      }
    }
    long long mx = *max_element(extra.begin(), extra.end());
    long long ans = 0;
    for (int i = int(1); i < int(n + 1); i++) {
      if (i != st) {
        if (deg[i] == 1) {
          cerr << "["
               << "i"
               << "] = [";
          _print(i);
        }
        assert(deg[i] != 1);
      }
      if (deg[i] >= 2 || i == st) {
        ans += ws[i];
      }
    }
    cout << ans + mx << "\n";
  }
  return 0;
}
