#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 100000;
ll N, M;
ll a[MAX_N];
ll x[MAX_N], y[MAX_N];

static const int MAX_UF = MAX_N;

template <class T> class UnionFind {
private:
  T par[MAX_UF];
  T rank[MAX_UF];
  
public:
  T find(T x);
  void init(T n);
  void unite(T x, T y);
  bool same (T x, T y);
};

template <class T> void UnionFind<T>::init(T n) {
  for (T i = 0; i < n; ++i) {
    par[i] = i;
    rank[i] = 0;
  }
}

template <class T> T UnionFind<T>::find(T x) {
  if (par[x] == x) {
    return x;
  } else {
    return par[x] = find(par[x]);
  }
}

template <class T> void UnionFind<T>::unite(T x, T y) {
  x = find(x); y = find(y);
  if (x == y) {
    return;
  } else {
    if (rank[x] > rank[y]) {
      par[y] = x;
    } else {
      par[x] = y;
      if (rank[x] == rank[y]) ++rank[y];
    }
  }
}

template <class T> bool UnionFind<T>::same(T x, T y) {
  return find(x) == find(y);
}

bool used[MAX_N];

int main() {
  std::ios::sync_with_stdio(false);std::cin.tie(0);

  cin >> N >> M;
  rep(i, N) cin >> a[i];
  rep(i, M) cin >> x[i] >> y[i];

  if (N == 1) {
      cout << 0 << endl;
      return 0;
  }

  if (N < 2*(N-M-1)) {
      cout << "Impossible" << endl;
      return 0;
  }

  UnionFind<ll> uf;
  uf.init(N);
  for (ll i = 0; i < M; ++i) {
      uf.unite(x[i], y[i]);
  }

  for (int i = 1; i < N; ++i) {
      if (!uf.same(i-1, i)) break;
      if (i+1 == N) {
          cout << 0 << endl;
          return 0;
      }
  }


  map<ll, Pll> mp;
  set<ll> pars;
  for (ll i = 0; i < N; ++i) {
      ll par = uf.find(i);
      mp[par] = Pll(INFLL, -1);
      pars.insert(par);
  }
  for (ll i = 0; i < N; ++i) {
      ll par = uf.find(i);
      if (mp[par].fi > a[i]) {
          mp[par] = Pll(a[i], i);
      }
  }

  ll ans = 0;
  ll count = 0;
  for (int par : pars) {
      ++count;
      Pll pll = mp[par];
      used[pll.sc] = true;
      ans += pll.fi;
  }

  vector<ll> v;
  for (ll i = 0; i < N; ++i) {
      if (!used[i]) v.push_back(a[i]);
  }
  sort(all(v));
  
  for (ll i = 0; count+1+i <= 2*(N-M-1); ++i) {
      ans += v[i];
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9600