import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;

void main() {
    int n, m;
    int[] a;

    scan(n, m);
    a = readln.split.to!(int[]);

    int t = 2 * (n - 1 - m);

    if (t > n) {
        writeln("Impossible");
        return;
    }

    int[][] adj = new int[][](n, 0);

    foreach (i ; 0 .. m) {
        int xi, yi;
        scan(xi, yi);
        adj[xi] ~= yi;
        adj[yi] ~= xi;
    }

    auto v = new bool[](n);

    int dfs(int i) {
        int res = i;
        v[i] = 1;

        foreach (j ; adj[i]) {
            if (!v[j]) {
                int mj = dfs(j);
                if (a[res] > a[mj]) {
                    res = mj;
                }
            }
        }

        return res;
    }

    auto used = new bool[](n);
    long ans;

    foreach (i ; 0 .. n) {
        if (t <= 0) break;
        if (!v[i]) {
            int mi = dfs(i);
            used[mi] = 1;
            ans += a[mi];
            t--;
        }
    }

    auto zan = new int[](0);

    foreach (i ; 0 .. n) {
        if (!used[i]) zan ~= a[i];
    }

    zan.sort();

    foreach (i ; 0 .. t) {
        ans += zan[i];
    }

    writeln(ans);
}




void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}
