// All Heil Fire Lord Zuko

#include <bits/stdc++.h>
using namespace std;

#define all(x) x.begin(), x.end()

const int N = 100 * 1000 + 19;

int n, m, a[N];
vector<int> adj[N];
vector <long long> v, vec;
bool mark[N];

void dfs(int v);

int32_t main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i < n; i ++)
        cin >> a[i];
    for (int i = 0; i < m; i ++) {
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    long long ans = 0, cnt = 0;
    if (m = n - 1)
        return cout << "Impossible", 0;
    if (m == 0)
        return cout << 0, 0;
    for (int i = 0; i < n; i ++)
        if (!mark[i]) {
            vec.clear();
            dfs(i);
            sort(all(vec));
            ans += vec[0], cnt ++;
            for (int j = 1; j < (int)vec.size(); j ++)
                v.push_back(vec[j]);
        }
    sort(all(v));
    int i = 0;
    while (i < (int)v.size() && cnt < 2 * (n - m - 1)) {
        ans += v[i];
        cnt ++;
        i ++;
    }
    cout << ans;
    return 0;
}

void dfs(int v) {
    mark[v] = true;
    vec.push_back(a[v]);
    for (auto u : adj[v])
        if (!mark[u])
            dfs(u);
}

/* THINGS TO CHECK !! */

// Runtime ->
// Overflows ->
// Order is ->

/* READ PROBLEM STATEMENT CAREFULLY */