#include <bits/stdc++.h>
using namespace std;
long long n, m, s, max_, val, ar[200005], dp[200005],
    func(long long, long long);
bool visit[200005];
vector<long long> vr[200005];
int main() {
  cin >> n >> m;
  for (int i = 1; i < n + 1; i++) cin >> ar[i];
  for (int i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    vr[x].push_back(y);
    vr[y].push_back(x);
  }
  cin >> s;
  func(s, 0);
  cout << max_ + val;
}
long long func(long long idx, long long p) {
  if (visit[idx]) return 0;
  visit[idx] = 1;
  long long size_ = vr[idx].size(), ch = 1;
  for (int i = 0; i < size_; i++) {
    if (vr[idx][i] == p) continue;
    ch &= func(vr[idx][i], idx);
    dp[idx] = max(dp[idx], dp[vr[idx][i]]);
  }
  dp[idx] += ar[idx];
  if (!ch)
    val += ar[idx];
  else
    max_ = max(max_, dp[idx]);
  return ch;
}
