#include <cstdio>
#include <algorithm>
using namespace std;
int par[100010];
int find(int x) {
	return x == par[x] ? x : (par[x] = find(par[x]));
}
void unite(int x, int y) {
	par[find(x)] = find(y);
}
int a[100010], c[100010];
int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		par[i] = i;
		c[i] = i;
	}
	int k = n;
	for (int i = 0; i < m; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		if (find(u) == find(v)) {
			continue;
		}
		--k;
		unite(u, v);
	}
	if ((k - 1) * 2 > n) {
		puts("Impossible");
		return 0;
	}
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		int x = find(i);
		if (a[c[x]] > a[i]) {
			c[x] = i;
		}
	}
	int s = 2 * (k - 1);
	for (int i = 0; i < n; i++) {
		if (s <= 0) {
			break;
		}
		if (find(i) == i) {
			ans += a[c[i]];
			a[c[i]] = 1001001001;
			--s;
		}
	}
	sort(a, a + n);
	for (int i = 0; i < s; i++) {
		ans += a[i];
	}
	printf("%lld\n", ans);
	return 0;
}
