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

#include<cstdio>

#include<algorithm>

#include<queue>

using namespace std;

typedef long long LL;

int n,m;

LL a[100000+10];

int par[100000+10];

priority_queue<LL> mini[100000+10];



int fpar(int x){

	if (par[x]==-1)return x;

	par[x]=fpar(par[x]);

	return par[x];

}

priority_queue <LL > pq1;

LL ans=0;

int main(){

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

	for (int f1=0;f1<n;f1++)scanf("%lld",&a[f1]);

	for (int f1=0;f1<n;f1++){par[f1]=-1;}

	for (int f1=0;f1<m;f1++){

		int i,j;

		scanf("%d%d",&i,&j);

		i=fpar(i);

		j=fpar(j);

		par[j]=i;

	}

	for (int f1=0;f1<n;f1++){

		int j=fpar(f1);

		mini[j].push(-a[f1]);

	}

	if (n==1+m){

		printf("0\n");

		return 0;

	}

	for (int f1=0;f1<n;f1++){

		if (par[f1]==-1){

			ans-=mini[f1].top();

			mini[f1].pop();

			while (!mini[f1].empty()){

				pq1.push(mini[f1].top());

				mini[f1].pop();

			}	

		}

	}

	

	if (int(pq1.size())>=n-m-2){

		for (int f1=1;f1<=n-m-2;f1++){

			ans-=pq1.top();

			pq1.pop();

		}

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

	} else printf("Impossible\n");

}

//

// Faster C++ solution for the same problem (measured speedup: 4.260318943392099x):
#include <bits/stdc++.h>

using namespace std;



#define ll long long

#define sd(x) scanf("%d", &(x))

#define pii pair<int, int>

#define F first

#define S second

#define all(c) ((c).begin()), ((c).end())

#define sz(x) ((int)(x).size())

#define ld long double



template<class T,class U>

ostream& operator<<(ostream& os,const pair<T,U>& p){

	os<<"("<<p.first<<", "<<p.second<<")";

	return os;

}



template<class T>

ostream& operator <<(ostream& os,const vector<T>& v){

	os<<"{";

	for(int i = 0;i < (int)v.size(); i++){

		if(i)os<<", ";

		os<<v[i];

	}

	os<<"}";

	return os;

}



#ifdef LOCAL

#define cerr cout

#else

#endif



#define TRACE



#ifdef TRACE

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>

void __f(const char* name, Arg1&& arg1){

	cerr << name << " : " << arg1 << std::endl;

}

template <typename Arg1, typename... Args>

void __f(const char* names, Arg1&& arg1, Args&&... args){

	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);

}

#else

#define trace(...)

#endif



struct dsu{

    int n;

    vector<int> par;

    vector<vector<int>> comp;

    int num;

    dsu(int n) : n(n), par(n), comp(n), num(n){

        iota(par.begin(), par.end(), 0);

    }

    int root(int x){

        return x == par[x] ? x : (par[x] = root(par[x]));

    }

    bool merge(int x, int y){

        x = root(x); y = root(y);

        if(x == y) return 0;

        par[x] = y;

        num--;

        return 1;

    }

    void get(){

        for(int i = 0; i < n; i++) comp[root(i)].push_back(i);

    }

};





int a[100005];

int main(){

    int n, m; sd(n); sd(m);

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

    dsu D(n);

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

        int u, v;

        sd(u); sd(v);

        D.merge(u, v);

    }

    if(D.num == 1){

        printf("0\n");

        return 0;

    }

    D.get();

    vector<int> rem;

    ll ans = 0;

    int num = 0;

    for(int i = 0; i < n; i++) if(!D.comp[i].empty()){

        vector<int> V = D.comp[i];

        sort(all(V), [&](int i, int j){

            return a[i] < a[j];

        });

        ans += a[V[0]];

        for(int j = 1; j < sz(V); j++) rem.push_back(a[V[j]]);

    }

    if(sz(rem) < D.num - 2){

        printf("Impossible\n");

        return 0;

    }

    sort(all(rem));

    for(int i = 0; i < D.num - 2; i++) ans += rem[i];

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

}