// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<queue>

#define mp(x,y) make_pair(x,y) 

#define ll long long

#define MN 200005

using namespace std;

inline ll in(){

    ll x=0;bool f=0;char c;

    for (;(c=getchar())<'0'||c>'9';f=c=='-');

    for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');

    return f?-x:x;

}

typedef pair<ll,int> pr;

//priority_queue<pr,vector<pr>,greater<pr> >q;

priority_queue<ll,vector<ll>,greater<ll> >q;

struct edge{

	int to,nxt;

}e[MN<<1];

ll a[MN],res;

int d[MN],fa[MN],rk[MN],num[MN],h[MN],ch[2][MN];

int n,m,x,y,cnt,tot,fx,fy,rt,ct;

bool vis[MN];

ll mn[MN];bool tmp[MN];

inline int gf(int x){return fa[x]?fa[x]=gf(fa[x]):x;}

inline void ins(int x,int y){

	e[++cnt].to=y;e[cnt].nxt=h[x];h[x]=cnt;

}

inline void dfs(int u){

	mn[tot]=min(mn[tot],a[u]);

	for (int i=h[u];i;i=e[i].nxt){

		int v=e[i].to;

		if (vis[v]) continue;

		vis[v]=1;num[v]=tot;dfs(v);

	}

}

inline int merge(int x,int y){

    if (!x) return y;if (!y) return x;

    if (a[x]>a[y]||(a[x]==a[y]&&x>y)) swap(x,y);

    ch[1][x]=merge(ch[1][x],y);fa[ch[1][x]]=x;

    if (d[ch[0][x]]<d[ch[1][x]]) swap(ch[0][x],ch[1][x]);

    d[x]=d[ch[1][x]]+1;return x;

}

inline int pop(int x){

    a[x]=-1;fa[x]=-1;fa[ch[0][x]]=fa[ch[1][x]]=0;

    return merge(ch[0][x],ch[1][x]);

}

int main()

{

	n=in();m=in();

	memset(mn,0x3f,sizeof(mn));

	for (int i=1;i<=n;++i) a[i]=in();

	for (int i=1;i<=m;++i){

		x=in()+1;y=in()+1;

		ins(x,y);ins(y,x);

	}

	for (int i=1;i<=n;++i)

	if (!vis[i]){

		vis[i]=1;num[i]=(++tot);

		rk[tot]=i;dfs(i);

	}

	if (tot==1) {printf("0");return 0;}

	for (int i=1;i<=tot;++i) res+=1ll*mn[i];

	for (int i=1;i<=n;++i){

		if (!tmp[num[i]]&&a[i]==mn[num[i]]) {tmp[num[i]]=1;continue;}

		else q.push(a[i]);

	}

	while (!q.empty()){

		if (ct==tot-2) break;

		ll x=q.top();q.pop();++ct;res+=1ll*x;

	} 

	if (ct==tot-2) printf("%lld",res);else printf("Impossible");

	/*

	for (int i=1;i<=n;++i){

		if (rk[num[i]]==i) continue;

		fx=gf(i),fy=gf(rk[num[i]]);merge(fx,fy);

	}

	for (int i=1;i<=tot;++i){

		fx=gf(rk[i]);q.push(mp(a[fx],fx));

	}

	while (!q.empty()){

		pr x=q.top();q.pop();

		if (q.empty()) break;pr y=q.top();q.pop();

		res+=1ll*x.first+y.first;++ct;

		fx=gf(x.second),fy=gf(y.second);printf("%d %d\n",fx,fy);

		fx=pop(fx);fy=pop(fy);rt=merge(fx,fy);

		if (rt) q.push(mp(a[rt],rt));

	}*/

//	if (ct+m!=n-1) printf("Impossible");

//	else 

//	printf("%lld",res);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.5301639598036565x):
#include<iostream>

#include<algorithm>

#include<cstdio>

#include<cstdlib>

#include<cmath>

#include<cstring>

#include<queue>

#include<vector>

#include<map>

using namespace std;

#define llg long long

#define maxn 200010

#define yyj(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout);



inline llg getint()

{

    llg w=0,q=0; char c=getchar();

    while((c<'0' || c>'9') && c!='-') c=getchar();

    if (c=='-')  q=1, c=getchar(); while (c>='0' && c<='9') w=w*10+c-'0', c=getchar();

    return q ? -w : w;

}



struct node{llg val,fa;} a[maxn];



bool cmp(const node &a,const node&b){return a.val<b.val;}



llg n,m,fa[maxn],ans,c[maxn],needb,xian[maxn],chuxian[maxn],bj[maxn];



llg find(llg x) {if (fa[x]!=x) fa[x]=find(fa[x]); return fa[x];}



int main()

{

	cin>>n>>m;

	for (llg i=1;i<=n;i++) c[i]=getint(),fa[i]=i;

	for (llg i=1;i<=m;i++)

	{

		llg x=getint(),y=getint();

		x++,y++;

		if (find(x)!=find(y)) fa[find(x)]=find(y);

	}

	for (llg i=1;i<=n;i++) a[i].val=c[i],a[i].fa=find(i);

	sort(a+1,a+n+1,cmp);

	needb=n-1-m;

	llg cs=0;

	for (llg i=1;i<=n && cs<needb*2;i++)

		if (!chuxian[a[i].fa])

		{

			cs++;

			bj[i]=1;

			chuxian[a[i].fa]=1;

			ans+=a[i].val;

		}

	for (llg i=1;i<=n && cs<needb*2;i++)

	{

		if (xian[a[i].fa]<needb && !bj[i])

		{

			xian[a[i].fa]++;

			ans+=a[i].val;

			cs++;

		}

	}

	if (cs<needb*2) puts("Impossible"); else 

	cout<<ans;

	return 0;

}