#include <bits/stdc++.h>
using namespace std;
namespace __library_79brue {
inline void quit() { exit(0); }
inline void readInt(int& _x) { scanf("%d", &_x); }
inline void readLong(long long& _x) { scanf("%lld", &_x); }
inline void readChar(char& _x) { scanf(" %c", &_x); }
inline void readChar2(char& _x) { scanf("%c", &_x); }
inline void readString(char* _x) { scanf("%s", _x); }
}  // namespace __library_79brue
using namespace __library_79brue;
int n, m;
long long arr[200002];
vector<int> link[200002];
int s;
queue<int> que;
int deg[200002];
long long DP[200002];
long long ans1, ans2;
int main() {
  readInt(n), readInt(m);
  for (int i = 1; i <= n; i++) readLong(arr[i]);
  for (int i = 1; i <= m; i++) {
    int x, y;
    readInt(x), readInt(y);
    link[x].push_back(y);
    link[y].push_back(x);
    deg[x]++, deg[y]++;
  }
  readInt(s);
  for (int i = 1; i <= n; i++) {
    if (deg[i] == 1 && i != s) {
      que.push(i);
    }
  }
  while (!que.empty()) {
    int tmp = que.front();
    que.pop();
    deg[tmp] = -1;
    for (auto& x : link[tmp]) {
      if (deg[x] < 0) continue;
      deg[x]--;
      DP[x] = max(DP[x], DP[tmp] + arr[tmp]);
      if (deg[x] == 1 && x != s) {
        que.push(x);
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (deg[i] < 0) continue;
    ans1 += arr[i];
    ans2 = max(ans2, DP[i]);
  }
  printf("%lld\n", ans1 + ans2);
}
