#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, m, a[N], mark[N], seen[N], cnt, num[N];
long long ans;
vector<int> gr[N];
pair<int, int> mn = {1e9 + 1, 1e9 + 1};
void dfs(int v) {
	mark[v] = 1;
	mn = min(mn, make_pair(a[v], v));
	for (auto u : gr[v])
		if (!mark[u])
			dfs(u);
	return;
}
int main() {
	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;
		gr[x].push_back(y);
		gr[y].push_back(x);
	}
	for (int i = 0; i < n; i++) {
		if (!mark[i]) {
			dfs(i);
			seen[mn.second] = 1;
			ans += mn.first;
			cnt++;
			mn = {1e9, 1e9};
		}
	}
	int nw = cnt * 2 - 2 - cnt;
	int plc = 0;
	iota(num, num + n, 0);
	sort(num, num + n, [] (int x, int y) { return a[x] < a[y]; });
	while (plc < n && nw > 0) {
		if (!seen[num[plc]]) {
			ans += a[num[plc]];
			nw--;
		}
		plc++;
	}
	if (nw > 0) {
		cout << "Impossible";
	}
	else {
		if (cnt == 1)
			cout << 0;
		else
			cout << ans;
	}
	return 0;
}