import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0; 
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
    int n = scan!int, m = scan!int;
    long[] as = scan!long(n);
    auto uf = new UnionFind(n);
    foreach(_; 0 .. m){
        int x = scan!int, y = scan!int;
        uf.unite(x, y);
    }

    int treecnt;
    foreach(i; 0 .. n) if(uf.find(i) == i) treecnt += 1;

    // 無理な場合は抜ける
    if((treecnt - 1) * 2 > n){
        "Impossible".print;
        return;
    }

    // 何もしなくてよい場合も抜ける
    if(treecnt == 1){
        "0".print;
        return;
    }


    // 各Union内での最小コストの点は採用される
    // それ以外は、全Unionを通じて小さいものから採用される
    S[] vs = new S[](n);
    foreach(i; 0 .. n){
        int r = uf.find(i);
        if(as[i] < vs[r].value) vs[r] = S(as[i], i);
    }

    long ans;
    int cnt;
    foreach(v; vs){
        if(v.value == infty) continue;
        ans += v.value;
        as[v.id] = infty;
        cnt += 1;
    }

    as.sort();
    foreach(i; 0 .. treecnt - 2) ans += as[i];

    ans.print;
}

const long infty = 1_000_000_999;
struct S{
    long value = infty;
    int id = -1;
}


class UnionFind{
    int[] rootOf;
    int[][] kidsOf;
    this(int n){
        rootOf = new int[](n);
        kidsOf = new int[][](n);
        foreach(i; 0 .. n) rootOf[i] = i, kidsOf[i] = [i];
    }
    void unite(int a, int b){
        log("a:", a, "b:", b);
        int ra = rootOf[a], rb = rootOf[b];
        if(ra == rb) return;
        if(kidsOf[ra].length < kidsOf[rb].length) unite(b, a);
        else foreach(k; kidsOf[rb]) rootOf[k] = ra, kidsOf[ra] ~= k;
    }
    int find(int a){
        return rootOf[a];
    }
    int getSize(int a){
        return kidsOf[rootOf[a]].length.to!int;
    }
}