#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 1e5 + 10;
int fa[maxn], mn_val[maxn], val[maxn], idx[maxn];
bool vis[maxn];
int n, m, u, v;

int Find(int x) {
    return fa[x] == x ? x : fa[x] = Find(fa[x]);
}

void Union(int x, int y) {
    int fx = Find(x), fy = Find(y);
    if(fx == fy) return;
    fa[fy] = fx;
    if(mn_val[fy] < mn_val[fx]) {
        mn_val[fx] = mn_val[fy];
        idx[fx] = idx[fy];
    }
}

int main(void) {
    scanf("%d%d", &n, &m);
    for(int i = 0; i < n; ++i) {
        idx[i] = fa[i] = i;
        scanf("%d", val + i);
        mn_val[i] = val[i];
    }
    while(m--) {
        scanf("%d%d", &u, &v);
        Union(u, v);
    }
    int cnt = 0;
    for(int i = 0; i < n; ++i) {
        if(fa[i] == i) {
            ++cnt;
            vis[idx[i]] = 1;
        }
    }
    if((cnt - 1) * 2 > n) return 0 * puts("Impossible");
    if(cnt == 1) return 0 * puts("0");
    vector<int> vt;
    ll sum = 0;
    for(int i = 0; i < n; ++i) {
        if(!vis[i]) vt.push_back(val[i]);
        else sum += val[i];
    }
    cnt -= 2;
    sort(vt.begin(), vt.end());
    for(int i = 0; i < cnt; ++i) sum += vt[i];
    printf("%lld\n", sum);
}