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

#define rep(i,a,b) for (int i=(a); i<=(b); i++)

#define per(i,a,b) for (int i=(a); i>=(b); i--)

using namespace std;



const int maxn = 100005;

int a[maxn], vis[maxn], n, m, x, y, mn, cur;

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

vector<int> e[maxn];

long long ans;



void dfs(int u) {

	int sz = e[u].size();

	if (a[u] < mn) mn = a[u], cur = u;

	vis[u] = 1;

	if (!sz) return;

	rep (i, 0, sz - 1)

		if (!vis[e[u][i]]) dfs(e[u][i]);

}



int main() {

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

	if (n < 2 * (n - m - 1)) 

		return puts("Impossible"), 0;

	if (n - 1 == m)

		return puts("0"), 0;

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

	rep (i, 1, m) {

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

		e[x].push_back(y); e[y].push_back(x);

	}

	rep (i, 1, n)

		if (!vis[i]) {

			mn = 2e9;

			dfs(i);

			ans += mn;

			a[cur] = 0;

		}

	rep (i, 1, n)

		if (a[i]) Q.push(a[i]);

	m = 2 * (n - m - 1) - (n - m);

	while (m-- > 0) {

		ans += Q.top();

		Q.pop();

	}

	cout << ans << endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.526752164727276x):
#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);

}