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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
inline int ctoi(char c) {if (c >= '0' && c <= '9') return (int)(c - '0'); return -1;}
inline int uatoi(char c) {if (c >= 'A' && c <= 'Z') return (int)(c - 'A'); return -1;}
inline int latoi(char c) {if (c >= 'a' && c <= 'z') return (int)(c - 'a'); return -1;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

class UnionFind {
    vector<int> parent;

    public:
        UnionFind(int size) {
            parent = vector<int>(size, -1);
        }

        int find(int x) {
            if (parent[x] < 0) {
                // parent itself
                return x;
            } else {
                return parent[x] = find(parent[x]);
            }
        }

        bool unite(int x, int y) {
            int rX, rY;
            if ((rX = find(x)) == (rY = find(y))) {
                // already united
                return false;
            }
            if (size(rX) < size(rY)) {
                int tmp = rX;
                rX = rY;
                rY = tmp;
            }
            parent[rX] += parent[rY];
            parent[rY] = rX;
            return true;
        }

        int size(int x) {
            return -parent[find(x)];
        }

        bool is_same(int x, int y) {
            return find(x) == find(y);
        }

        int component_count() {
            int c = 0;
            for (const int x : parent) {
                if (x < 0) {
                    c++;
                }
            }
            return c;
        }
};

void solve() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> a(n);
    int z;
    REP(i, n) {
        cin >> z;
        a[i] = make_pair(z, i);
    }
    sort(ALL(a));

    if (n == m + 1) {
        cout << 0 << EOL;
        return;
    } else if ((n - m - 1) * 2 > n) {
        cout << "Impossible" << EOL;
        return;
    }

    UnionFind uf(n);
    int x, y;
    REP(i, m) {
        cin >> x >> y;
        uf.unite(x, y);
    }

    vector<bool> united(n, false);
    vector<bool> selected(n, false);
    ll ans = 0;
    REP(i, n) {
        int idx = uf.find(a[i].second);
        if (united[idx]) continue;
        united[idx] = true;
        selected[a[i].second] = true;
        ans += (ll)a[i].first;
    }

    int s = uf.component_count() - 2;
    REP(i, n) {
        if (!selected[a[i].second]) {
            ans += (ll)a[i].first;
            s--;
        }
        if (s <= 0) break;
    }

    cout << ans << EOL;
}



Measured memory_bytes: 1408