#include <cstdio>
#include <cstdlib>
#include <algorithm>

const int maxn = 1e5 + 20;

int n, m, A[maxn], F[maxn];
std::pair<int,int> M[maxn];
bool used[maxn];

int find(int x)
{
	return F[x] == x ? x : (F[x] = find(F[x]));
}
template<class TAT>void checkmin(TAT &x,const TAT &y)
{
	if(y < x) x = y;
}
int main()
{
	scanf("%d%d", &n, &m);
	for(int i = 0; i < n; i++) scanf("%d", &A[i]);
	
	for(int i = 0; i < n; i++) F[i] = i;
	
	for(int i = 0, x, y; i < m; i++)
	{
		scanf("%d%d", &x, &y);
		F[find(x)] = find(y);
	}
	
	for(int i = 0; i < n; i++)
		M[i] = std::make_pair(A[i], i);
	
	for(int i = 0; i < n; i++)
		checkmin(M[find(i)], M[i]);
	
	long long ans = 0;
	int cnt = 0;
	
	for(int i = 0; i < n; i++)
		if(find(i) == i)
		{
			ans += M[i].first, cnt++;
			used[M[i].second] = true;
		}

	if(cnt == 1)
	{
		printf("0\n");
	}
	else if(n < (cnt - 1) * 2)
	{
		printf("Impossible\n");
	}
	else
	{
		for(int i = 0; i < n; i++)
			M[i] = std::make_pair(A[i], i);
		std::sort(M, M + n);
		
		int rem = (cnt - 1) * 2 - cnt;
		
		for(int i = 0; i < n && rem; i++)
		{
			if(used[M[i].second]) continue;
			ans += M[i].first, rem--;
		}
		
		printf("%lld\n", ans);
	}
	
	return 0;
}