// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5+100;

typedef long long LL;

int val[maxn],First[maxn],cnt,N,M;

int tot,pre[maxn];

LL ans = 0;

struct node{

    int to,Next;

}Tree[maxn*2];

void init(){

    memset(First,-1,sizeof(First));

    cnt = 0;

}

void addedge(int from,int to){

    Tree[cnt].to = to;

    Tree[cnt].Next = First[from];

    First[from] = cnt++;

}

priority_queue<int,vector<int>,greater<int> > Q[maxn];

void dfs(int u,int fa){

    pre[u] = 1;

    Q[tot].push(val[u]);

    for(int i = First[u];i!=-1;i=Tree[i].Next){

        int to = Tree[i].to;

        if(to==fa)continue;

        dfs(to,u);

    }

}

vector<int> ac,bc;

int main(){

    init();

    scanf("%d%d",&N,&M);

    for(int i = 0;i<=N-1;i++)scanf("%d",&val[i]);

    for(int i = 0;i<M;i++){

        int a,b;

        scanf("%d%d",&a,&b);

        addedge(a,b);

        addedge(b,a);

    }

    for(int i = 0;i<=N-1;i++){

        if(!pre[i]){

            tot++;

            dfs(i,-1);

            ac.push_back(tot);

        }

    }

    if(tot==1){

        printf("%d\n",0);

        return 0;

    }

    bool flag = 0;

    priority_queue<int,vector<int>,greater<int> >QQ;

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

       ans+=Q[i].top();

       Q[i].pop();

       while(!Q[i].empty()){

        QQ.push(Q[i].top());

        Q[i].pop();

       }

    }

    int my =tot-2;

    if(QQ.size()<my){

        printf("Impossible\n");

        return 0;

    }

    for(int i = 0;i<my;i++){

        ans+=QQ.top();

        QQ.pop();

    }

    printf("%lld\n",ans);

    return 0;

}

/*

7 4

1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000

0 1

1 2

3 4

5 6

6 3

1 1 1 3 7 8

0 4

1 5

2 3

*/


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

#include<cstdio>

#include<algorithm>

#include<cstring>

#include<queue>

#define MX 100005

using namespace std;

typedef pair<int,int> PA;

inline int read()

{

	int x=0,f=1;char c=getchar();

	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}

	while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();

	return x*f;

}

int n,m;

int a[MX],fa[MX],bl[MX],vis[MX];

priority_queue<PA> que[MX];

priority_queue<int> q;

int zbb(int k){return fa[k]==k?k:fa[k]=zbb(fa[k]);}

int main(){

	//freopen("a.in","r",stdin);

	n=read();m=read();

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

		a[i]=read();

	

	for(int i=0;i<n;i++) fa[i]=i;

	

	int x,y,r1,r2;

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

	{

		x=read();y=read();

		r1=zbb(x);r2=zbb(y);

		if(r1!=r2)

			fa[r2]=r1;

	}

	

	int cnt=0;

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

	{

		r1=zbb(i);

		if(!vis[r1])

		{

			vis[r1]=1;

			cnt++;

			bl[r1]=cnt;

		}

		que[bl[r1]].push(make_pair(-a[i],i));

	}

	

	if(cnt==1)

	{

		printf("0\n");

		return 0;

	}

	if(n<cnt*2-2)

	{

		printf("Impossible\n");

		return 0;

	}

	

	long long ans=0;

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

	{

		ans-=que[i].top().first;

		que[i].pop();

	}

	

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

		while(!que[i].empty())

		{

			q.push(que[i].top().first);

			que[i].pop();

		}

	

	for(int i=1;i<=cnt-2;i++)

	{

		ans-=q.top();q.pop();

	}

	

	cout<<ans<<endl;

	return 0;

}