// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

using ll=long long;

template<class T> using V = vector<T>;

template<class T, class U> using P = pair<T, U>;

using vll = V<ll>;

using vvll = V<vll>;

#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)

#define REP(i, n) rep(i, 0, n)



const ll MOD = 10007;

const ll HIGHINF = (ll)1e18;



vll forest(100000, -1);

vvll nodes(100000, vll());

vll a(100000);

V<bool> used(100000, false);



ll dfs(ll i, ll k) {

  ll mini = i;

  REP(nxt, nodes.at(i).size()) {

    if (forest.at(nodes.at(i).at(nxt)) == -1) {

      forest.at(nodes.at(i).at(nxt)) = k;

      ll ci = dfs(nodes.at(i).at(nxt), k);

      if (a.at(mini) > a.at(ci)) mini = ci;

    }

  }

  return mini;

}



int main() {

  ll n, m; cin >> n >> m;

  REP(i, n) cin >> a.at(i);

  REP(i, m) {

    ll x, y; cin >> x >> y;

    nodes.at(x).push_back(y);

    nodes.at(y).push_back(x);

  }

  if (m == n-1) cout << 0 << endl;

  else if (n < 2*(n-m-1)) cout << "Impossible" << endl;

  else {

    ll k = 0;

    REP(i, n) {

      if (forest.at(i) == -1) {

        forest.at(i) = k;

        ll mini = dfs(i, k);

        used.at(mini) = true;

        k++;

      }

    }

    ll ans = 0, c = 0;

    priority_queue<ll, vll, greater<ll>> pq;

    REP(i, n) {

      if (!used.at(i)) pq.push(a.at(i));

      else {

        ans += a.at(i); c++;

      }

    }

    REP(i, 2*(n-m-1)-c) {

      ans += pq.top(); pq.pop();

    }

    cout << ans << endl;

  }

  return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <array>

#include <algorithm>

#include <vector>

#include <bitset>

#include <set>

#include <unordered_set>

#include <cmath>

#include <complex>

#include <deque>

#include <iterator>

#include <numeric>

#include <map>

#include <unordered_map>

#include <queue>

#include <stack>

#include <string>

#include <tuple>

#include <utility>

#include <limits>

#include <iomanip>

#include <functional>

#include <cassert>

using namespace std;



using ll=long long;

template<class T> using V = vector<T>;

template<class T, class U> using P = pair<T, U>;

using vll = V<ll>;

using vvll = V<vll>;

#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)

#define REP(i, n) rep(i, 0, n)

#define ALL(v) v.begin(),v.end()

template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }

template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }

#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');



const long long MOD = 1000000007;

const long long HIGHINF = (long long)1e18;

const int INF = (int)1e9;



ll n, m;

vll a;

V< V<int> > edges;



V<int> col;

void dfs(int i, int p, int c) {

    if (col[i] != -1) return;

    col[i] = c;

    for (int e: edges[i]) {

        if (e == p) continue;

        if (col[e] == -1) dfs(e, i, c);

    }

}



int main() {

    cin.tie(0);

    ios::sync_with_stdio(false);

    cin >> n >> m;

    a.resize(n), edges.resize(n);

    for (ll i = 0; i < n; i++) cin >> a[i];

    for (ll i = 0; i < m; i++) {

        int x, y; cin >> x >> y;

        edges[x].emplace_back(y);

        edges[y].emplace_back(x);

    }



    if (n - m == 1) cout << 0 << '\n';

    else if (n > 2 * (m + 1)) cout << "Impossible\n";

    else {

        col.resize(n, -1);

        int c = 0;

        for (int i = 0; i < n; i++) {

            if (col[i] == -1) {

                dfs(i, -1, c);

                c++;

            }

        }



        vvll aset(c);

        for (int i = 0; i < n; i++) {

            aset[col[i]].emplace_back(a[i]);

        }



        ll ans = 0;

        priority_queue<ll> pq;

        for (int i = 0; i < c; i++) {

            sort(ALL(aset[i]));

            ans += aset[i][0];

            for (int j = 1; j < aset[i].size(); j++) {

                pq.push(-(aset[i][j]));

            }

        }



        for (int i = 0; i < 2 * (n - m - 1) - c; i++) {

            ans += -pq.top();

            pq.pop();

        }

        cout << ans << '\n';

    }

    return 0;

}


// Fastest known solution for this problem: