#include<cstdio>
#include<algorithm>
#include<cstring>
#define MN 200005
using namespace std;
typedef long long ll;
ll ans;
bool used[MN];
int n,m,fa[MN],id[MN],a[MN],sz[MN];
int getf(int x){return x==fa[x]?x:fa[x]=getf(fa[x]);}
bool cmp(int x,int y){return a[x]<a[y];}
int main(){
	scanf("%d%d",&n,&m);int tt=(n-1-m)*2;int x,y;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),fa[i]=id[i]=i;sort(id+1,id+n+1,cmp);
	for(int i=1;i<=m;i++)scanf("%d%d",&x,&y),fa[getf(++x)]=getf(++y);
	
	for(int i=1;i<=n&&tt;i++)if(!used[id[i]]){
		if(sz[getf(id[i])])continue;
		sz[getf(id[i])]++,used[id[i]]=1,--tt,ans+=a[id[i]];
	}
	for(int i=1;i<=n&&tt;i++)if(!used[id[i]]){
		if(sz[getf(id[i])]+1>n-1-m)continue;
		sz[getf(id[i])]++,--tt,ans+=a[id[i]];
	}if(tt)puts("Impossible");else printf("%lld\n",ans);
}
