#include<bits/stdc++.h>
using namespace std;
#define ll long long 
const int N=1e5+100;
typedef pair<int,int>pii;
int f[N],a[N];
int find(int x)
{
	return x==f[x]?x:f[x]=find(f[x]);
}
priority_queue<pii,vector<pii>,greater<pii> >q[N];
vector<int>v;
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++) cin>>a[i],f[i]=i;
	f[n]=n;
	for(int i=1,x,y;i<=m;i++)
	{
		cin>>x>>y;
		f[find(x)]=find(y);
	}
	ll ans=0;
	for(int i=0;i<n;i++)
	 q[find(i)].push({a[i],i});
	for(int i=0;i<n;i++)
	{
		if(q[i].size())
		{
			v.push_back(i);
			ans+=q[i].top().first;
			a[q[i].top().second]=2e9;
		}
	}
	if(v.size()==1) cout<<0<<endl; 
	else if(n<2*(v.size()-1)) cout << "Impossible" << endl;
	else
	{
		sort(a,a+n);
		n=v.size()-2;
		for(int i=0;i<n;i++)
		 ans+=a[i];
		cout<<ans<<endl;
	}
	return 0;
}