#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
#define ff first
#define ss second

int a[100000];
bool used[100000], vis[100000];
vector<int> edge[100000];
pii dfs(int x){
	vis[x] = 1;
	pii ret = {a[x], x};
	for(auto i: edge[x]){
		if(vis[i]) continue;
		ret = min(ret, dfs(i));
	}
	return ret;
}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	int N, M; cin>>N>>M;
	for(int i=0; i<N; ++i) cin>>a[i];
	for(int i=0; i<M; ++i){
		int x,y; cin>>x>>y;
		edge[x].push_back(y);
		edge[y].push_back(x);
	}
	if(M==N-1) return !printf("0");
	long long ans = 0;
	for(int i=0; i<N; ++i){
		if(vis[i]) continue;
		pii t = dfs(i);
		ans += t.ff;
		used[t.ss] = 1;
	}
	vector<pii> vec;
	for(int i=0; i<N; ++i) if(!used[i]) vec.emplace_back(a[i], i);
	sort(vec.begin(), vec.end());
	if((int)vec.size() < N-M-2) cout<<"Impossible";
	else{
		for(int i=0; i<N-M-2; ++i) ans += vec[i].ff;
		cout<<ans;
	}
	return 0;
}