// SUBLIME HAX
	/*nope
	cat
	// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars// sixteen chars
	// ayy
	// ' lamo
	*/
	#include <bits/stdc++.h>
	using namespace std;
	template<class T,class U>
	ostream &operator<<(ostream &os,const pair<T,U> &x) {
		return os<<"("<<x.first<<","<<x.second<<")";
	}
	namespace dbg_ns {
		template<typename C>
		struct is_iterable {
			template<class T> static long check(...);
			template<class T> static char check(int,
				typename T::const_iterator = C().end());
			enum {
				value = sizeof(check<C>(0)) == sizeof(char),
				neg_value = sizeof(check<C>(0)) != sizeof(char)
			};
		};
		template<class T> ostream &_out_str(ostream &os,const T &x) {
			return os<<'"'<<x<<'"';
		}
		template<class T> ostream &_dbg2_5(ostream &,const T &);
		template<bool B,typename T=void> using eit=typename enable_if<B,T>::type;
		template<class T>
		inline ostream &_dbg3(ostream &os,eit<is_iterable<T>::neg_value,const T> &x) {
			return os<<x;
		}
		template<class T>
		inline ostream &_dbg3(ostream &os,eit<is_iterable<T>::value,const T> &V) {
			os<<"{";
			bool ff=0;
			for(const auto &E:V) _dbg2_5(ff?os<<",":os,E), ff=1;
			return os<<"}";
		}
		template<>
		inline ostream &_dbg3<string>(ostream &os,const string &x) {
			return _out_str(os,x);
		}
		template<>
		inline ostream &_dbg3<const char *>(ostream &os,const char *const &x) {
			return _out_str(os,x);
		}
		template<class T> inline ostream &_dbg2_5(ostream &os,const T &x) {
			return _dbg3<T>(os,x);
		}
		template<class T,typename... Args> ostream &_dbg2(ostream &os,vector<string>::iterator nm,const T &x,Args&&... args);
		inline ostream &_dbg2(ostream &os,vector<string>::iterator) { return os; }
		template<typename... Args>
		inline ostream &_dbg2(ostream &os,vector<string>::iterator nm,const char *x,Args&&... args) {
			return _dbg2(_dbg3<const char *>(os<<"  ",x),nm+1,args...);
		}
		template<class T,typename... Args>
		inline ostream &_dbg2(ostream &os,vector<string>::iterator nm,const T &x,Args&&... args) {
			return _dbg2(_dbg3<T>(os<<"  "<<*nm<<"=",x),nm+1,args...);
		}
		vector<string> split(string s) {
			vector<string> Z;
			string z="";
			s+=',';
			int dep=0;
			for(char c:s) {
				if(c==',' && !dep) Z.push_back(z),z="";
				else z+=c;
				if(c=='(') ++dep;
				if(c==')') --dep;
			}
			return Z;
		}
		template<typename... Args> inline ostream &_dbg1(int ln,const string &nm,Args&&... args) {
			auto nms=split(nm);
			return _dbg2(cerr<<"L"<<ln<<":",nms.begin(),args...)<<endl;
		}
	}
	#define dbg(...) dbg_ns::_dbg1(__LINE__,#__VA_ARGS__,__VA_ARGS__)
	#define sz(x) (int(x.size()))
	#define eprintf(...) fprintf(stderr,__VA_ARGS__)
	#define fi first
	#define se second
	#define pb push_back
// END SUBLIME HAX
// #include <bits/extc++.h>
// using namespace __gnu_pbds;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld; //CARE
typedef complex<ld> pt;
const ld eps=(ld)1e-8;
const ld tau=2*(ld)acosl(-1);
const int inf=1e9+99;
const ll linf=1e18+99;
const int P=1e9+7;



const int N=100<<10;
int n,m,a[N];


int da[N],sz[N];
multiset<int> vv[N];
int rt(int u) { return da[u]==u ? u : da[u]=rt(da[u]); }
int un(int u,int v) {
	u=rt(u),v=rt(v);
	if(u==v) return -1;
	if(sz[u]>sz[v]) swap(u,v);
	sz[v]+=sz[u];
	for(int x:vv[u]) vv[v].insert(x);
	da[u]=v;
	return v;
}

int p1(multiset<int> &ms) {
	if(!sz(ms)) return inf;
	int x=*ms.begin();
	ms.erase(ms.begin());
	return x;
}

vector<int> cc2[N],ccs;
int mx[N];
bool spend[N];

int32_t main() {
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++) scanf("%d",a+i), vv[i].insert(a[i]), da[i]=i, sz[i]=1;
	for(int i=0;i<m;i++) {
		int u,v; scanf("%d%d",&u,&v);
		un(u,v);
	}


	for(int i=0;i<n;i++) if(rt(i)==i) ccs.pb(i), mx[i]=i;
	for(int i=0;i<n;i++) if(a[i]<a[mx[rt(i)]]) mx[rt(i)]=i;

	if(sz(ccs)==1) return printf("0\n"),0;
	assert(sz(ccs)>=2);

	ll ZZ=0;
	for(int c:ccs) ZZ+=a[mx[c]], spend[mx[c]]=1;
	vector<int> v;
	for(int i=0;i<n;i++) if(!spend[i]) v.pb(a[i]);
	sort(v.begin(),v.end());

	int need=sz(ccs)-2;
	if(need>sz(v)) return printf("Impossible\n"),0;
	ZZ+=accumulate(v.begin(),v.begin()+need,0LL);
	printf("%lld\n",ZZ);




// 	set<pair<int,int> > ccs;
// 	for(int i=0;i<n;i++) if(rt(i)==i) ccs.insert({p1(vv[i]),i});
// 	ll ZZ=0;
// 	for(;sz(ccs)>1;) {
// 		auto P=*ccs.begin(); ccs.erase(ccs.begin());
// 		auto Q=*ccs.begin(); ccs.erase(ccs.begin());
// 		if(P.fi==inf || Q.fi==inf) return printf("Impossible\n"),0;
// 		// dbg(sz(ccs),P,Q);
// 		ZZ+=P.fi; ZZ+=Q.fi;
// 		int u=un(P.se,Q.se);
// 		assert(~u);
// 		ccs.insert({p1(vv[u]),u});
// 	}
// 	assert(sz(ccs)==1);
// 	printf("%lld\n",ZZ);
}













Measured memory_bytes: 23808