#include<bits/stdc++.h>

using namespace std;

int mini, how, N, M, val[100009], ap[100009], block[100009];
vector < int > v[100009];

void dfs (int nod)
{
    ap[nod] = 1;
    if (val[nod] < mini)
        mini = val[nod], how = nod;
    for (auto it : v[nod])
        if (ap[it] == 0)
            dfs (it);
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d %d", &N, &M);
for (int i=1; i<=N; i++)
    scanf ("%d", &val[i]);
while (M --)
{
    int x, y;
    scanf ("%d %d", &x, &y), x ++, y ++;
    v[x].push_back (y);
    v[y].push_back (x);
}
long long ans = 0;
int cnt = 0;
for (int i=1; i<=N; i++)
    if (ap[i] == 0)
        mini = 1e9 + 5, dfs (i), block[how] = 1, ans += mini, cnt ++;
if (cnt == 1)
{
    printf ("0\n");
    return 0;
}
vector < int > h;
for (int i=1; i<=N; i++)
    if (block[i] == 0)
        h.push_back (val[i]);
sort (h.begin (), h.end ());
if (h.size () < cnt - 2)
{
    printf ("Impossible\n");
    return 0;
}
for (int i=0; i<cnt - 2; i++)
    ans += h[i];
printf ("%lld\n", ans);
return 0;
}
