#include<bits/stdc++.h>
using namespace std;
int n,m,s;
vector<int>edge[200007];
queue<int>leaf;
int weight[200007],degree[200007];
long long wei[200007];//当前点深搜下去的链的总重(不包括当前结点,当前结点权重通过weight已经计算在内)
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>m;
for(int i=1;i<=n;++i)
cin>>weight[i];
for(int i=1;i<=m;++i){
int u,v;
cin>>u>>v;
edge[u].push_back(v);
edge[v].push_back(u);
++degree[u];
++degree[v];
}
cin>>s;
for(int i=1;i<=n;++i)
if(degree[i]==1&&i!=s)//如果s也是叶子,这条链的重量会计算在环内
leaf.push(i);
while(!leaf.empty()){
int i=leaf.front();
leaf.pop();
degree[i]=-1;//避免重复访问
for(int j=0;j<edge[i].size();++j){
if(degree[edge[i][j]]<0)//孤立结点
continue;
--degree[edge[i][j]];//访问过后拆边
wei[edge[i][j]]=max(wei[edge[i][j]],wei[i]+weight[i]);//更新当前结点可选择的链的最大值
if(degree[edge[i][j]]==1&&edge[i][j]!=s)
leaf.push(edge[i][j]);
}
}
long long ans=0;//环的总重
long long mx=0;//最大值的链的重量
for(int i=1;i<=n;++i){
if(degree[i]<0)
continue;
ans+=weight[i];
mx=max(mx,wei[i]);
}
cout<<ans+mx;
return 0;
}