#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef long long ll;
typedef long long integer;
//////////////////////////////////////////////////
struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size,-1) { }

    int root(int x){
        if (data[x] < 0) return x;
        else return data[x] = root(data[x]);
    }

    int size(int x){
        return -data[root(x)];
    }

    bool isConnect(int x,int y){
        return root(x) == root(y);
    }

    bool connect(int x , int y){
        x = root(x);
	    y = root(y);
	
        if(x==y) return false;
        
        if(data[x] > data[y]){
            x ^= y;
            y ^= x;
            x ^= y;
        }
        
        data[x] = data[x] + data[y]; // membersize++
        data[y] = x;
        return true;
    }
};

UnionFind U(100002);

int main(){
    const integer inf = 2000000000;
    int N,M; SCD2(N,M);
    static integer a[100000] = {};
    REP(i,N){
        SCLLD(a[i]);
    }

    REP(i,M){
        int x,y; SCD2(x,y);
        U.connect(x,y);
    }

    vector<integer>ccn;
    vector< vector<integer> > ccs(N);

    REP(i,N){
        U.root(i);
    }

    vector< VI >cc(N);

    REP(i,N){

        if (U.data[i] < 0){
            ccn.PB(-U.data[i]);
            cc[i].PB(i);
        }else{
            cc[U.data[i]].PB(i);
        }
    }


    static integer mini[100000];
    static int miniin[100000];
    REP(i,N){
        mini[i] = inf;
        miniin[i] = -1;
    }

    int one = 0;
    int ccnum = 0;

    if (M==N-1){
        PRINTD(0);
        return 0;
    }else if(N > 2*M+2){
        printf("Impossible\n");
        return 0;
    }

    REP(i,N){
        
        if (cc[i].empty()) continue;

/*         REP(j,cc[i].size()){
            printf("%d ",cc[i][j]);
        } 
        printf("\n");*/

        if (cc[i].size() == 1) one++;
        ccnum++;
        REP(j,cc[i].size()){
            int num = cc[i][j];
            if (a[num] < mini[i]){
                mini[i] = a[num];
                miniin[i] = num;
            }
        }
    }

    integer sum = 0;
    priority_queue<integer,vector<integer>,greater<integer> >Q;
    REP(i,N){
        //printf("mini[%d] = %lld\n",i,mini[i]);
        if (mini[i] == inf) continue;
        sum += mini[i];
    }

    REP(i,N){
        if (cc[i].empty()) continue;
        REP(j,cc[i].size()){
            if (cc[i][j] != miniin[i]){
                Q.push(a[cc[i][j]]);
            }
        }

    }

    REP(i,2*(N-M-1) - ccnum){
        sum += Q.top();
        Q.pop();
    }

    PRINTLLD(sum);
}




Measured memory_bytes: 11124