#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
#define PI 3.1415926535
using namespace std;
int union_find[200000] = {};
int usable[200000] = {};
int used[200000] = {};
int finding(int now) {
	if (union_find[now] == now) return now;
	return union_find[now] = finding(union_find[now]);
}
int setting(int a, int b) {
	usable[a] = 1;
	usable[b] = 1;
	a = finding(a), b = finding(b);
	union_find[a] = b;
	return 0;
}
vector<int> vertexs[200000];
long long cost[200000] = {};
int main() {
	int n, m;
	cin >> n >> m;
	if (n == m + 1) {
		cout << 0 << endl;
		return 0;
	}
	REP(i, n) {
		union_find[i] = i;
		cin >> cost[i];
	}
	REP(i, m) {
		int a, b;
		cin >> a >> b;
		vertexs[a].push_back(b);
		vertexs[b].push_back(a);
		setting(a, b);
	}
	vector<pair<long long, int>> next;
	for (int i = 0;i < n;++i) {
		if (usable[i] == 1) {
			next.push_back(make_pair(cost[i], i));
		}
	}
	long long ans = 0;
	sort(next.begin(), next.end());
	queue <pair<long long, int >> stock;
	for (int i = 0;i < next.size();++i) {
		if (stock.empty() == true) {
			stock.push(next[i]);
		}
		else {
			if (finding(next[i].second) == finding(stock.front().second)) {
				stock.push(next[i]);
			}
			else {
				//take
				ans += stock.front().first + next[i].first;
				setting(stock.front().second, next[i].second);
				used[stock.front().second] = 1;
				used[next[i].second] = 1;
				stock.pop();
			}
		}
	}
	vector<long long> smaller, bigger;
	for (int i = 0;i < n;++i) {
		if (used[i] == 0) {
			if (usable[i] == 0) {
				smaller.push_back(cost[i]);
			}
			else {
				bigger.push_back(cost[i]);
			}
		}
	}
	if (bigger.size() < smaller.size()) {
		if (bigger.size() == 0) {
			if (smaller.size() == 1) {
				cout << 0 << endl;
				return 0;
			}
			if (smaller.size() == 2) {
				cout << smaller[0] + smaller[1] << endl;
				return 0;
			}
		}
		cout << "Impossible" << endl;
		return 0;
	}
	int visited[200000] = {};
	ans = 0;
	int cnt = 2*(n-m-1);
	vector<long long> nyaa;
	for (int i = 0;i < n;++i) {
		if (visited[i] == 0) {
			visited[i] = 1;
			queue<int> next;
			next.push(i);
			vector<int> mewmew;
			cnt--;
			mewmew.push_back(cost[i]);
			while (next.empty() == false) {
				int now = next.front();
				next.pop();
				for (int q = 0;q < vertexs[now].size();++q) {
					if (visited[vertexs[now][q]] == 0) {
						visited[vertexs[now][q]] = 1;
						mewmew.push_back(cost[vertexs[now][q]]);
						next.push(vertexs[now][q]);
					}
				}
			}
			sort(mewmew.begin(), mewmew.end());
			ans += mewmew[0];
			for (int q = 1;q < mewmew.size();++q) {
				nyaa.push_back(mewmew[q]);
			}
		}
	}
	sort(nyaa.begin(), nyaa.end());
	for (int i = 0;i < cnt;++i) {
		ans += nyaa[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 17904