// Original C++ solution (slower):
#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

*/


// Optimized solution to the same problem (faster):
#include <iostream>

#include<cstdio>

#include<set>

#include<queue>

#include<vector>

#include<map>

#include<cmath>

#include<cstdlib>

#include<algorithm>

#include<string>

#include<cstring>



using namespace std;



int a[100005],fa[100005],vis[100005],mi[100005];

priority_queue<pair<int,int>, vector<pair<int,int> >, greater<pair<int,int> > >q;



int _find(int x)

{

    return fa[x]==x?x:fa[x]=_find(fa[x]);

}



void _merge(int x,int y)

{

    int fx=_find(x),fy=_find(y);

    if(fx!=fy)

    {

        fa[fx]=fy;

    }

}

int main()

{

	int n,m;

	scanf("%d %d",&n,&m);

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

	{

	    scanf("%d",&a[i]);

	    fa[i]=i;

	    mi[i]=1e9+9;

	}

	int x,y;

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

    {

        scanf("%d %d",&x,&y);

        _merge(x,y);

    }

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

        _find(i);

    pair<int,int>tt;

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

	{

	    mi[fa[i]]=min(a[i],mi[fa[i]]);



	    tt.first=a[i];

	    tt.second=fa[i];

	    q.push(tt);

	}

	sort(fa,fa+n);

	int cnt=unique(fa,fa+n)-fa;

	if(cnt==1)

        printf("0\n");

    else

    {

        long long ans=0;

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

            ans+=mi[fa[i]];

        while(!q.empty())

        {

            if(cnt==2)

                break;

            pair<int,int>tmp;

            tmp=q.top();

            q.pop();

            if(vis[tmp.second]==0)

            {

                vis[tmp.second]=1;

                continue;

            }

            ans+=tmp.first;

            cnt--;

        }

        if(cnt==2)

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

        else

            printf("Impossible\n");

    }

    return 0;

}


// Fastest known solution for this problem: