#include "bits/stdc++.h"

#define X first
#define Y second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define rep(i, a, b) for (long i = (a); i <= (b); ++i)
#define per(i, a, b) for (long i = (a); i >= (b); --i)

using namespace std;

using I = int;
using L = long;
using F = float;
using S = string;
using SS = stringstream;
using C = char;
using LL = long long;
using VI = vector<int>;
using VL = vector<long>;
using VF = vector<float>;
using VS = vector<string>;
using VVI = vector<vector<int>>;
using VVL = vector<vector<long>>;
using PLL = pair<long, long>;
using PLF = pair<long, float>;
using PLS = pair<long, string>;
using PSL = pair<string, long>;
using PSF = pair<string, float>;
using PSS = pair<string, string>;
using MLL = map<long, long>;
using MLF = map<long, float>;
using MLS = map<long, string>;
using MSL = map<string, long>;
using MSF = map<string, float>;
using MSS = map<string, string>;

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;

template <class T>
void PrintVector(const vector<T> & v) {
  for (const auto & e: v) {
    cout << e << endl;
  }
}

template <class T>
void PrintVector(const vector<T> & v, I n) {
  rep(i, 0, n - 1) {
    cout << v[i] << endl;
  }
}
enum class Color {
  kWhite,
  kGrey,
  kBlack,
};

struct Edge {
  using w_type = int;
  Edge(int u, int v, w_type w): u(u), v(v), w(w) { }
  int u, v;
  w_type w;
  bool operator<(const Edge & rhs) const {
    if (w != rhs.w) { return w < rhs.w; }
    if (u != rhs.u) { return u < rhs.u; }
    return v < rhs.v;
  }
};

const int kNil = -1;

VI d(100005, 0);
vector<vector<Edge>> adjacency_list(100005, vector<Edge>());
vector<Color> color(100005, Color::kWhite);

void DFSVisit(const int node_now, int & min_d, int & min_node) {
  if (d[node_now] < min_d) {
    min_d = d[node_now];
    min_node = node_now;
  }
  color[node_now] = Color::kGrey;
  for (const auto & e: adjacency_list[node_now]) {
    if (color[e.v] == Color::kWhite) {
      DFSVisit(e.v, min_d, min_node);
    }
  }
  color[node_now] = Color::kBlack;
}

int main(int argc, char const *argv[]) {
  using w_type = int;
  vector<Edge> edges;
  I n, m;
  cin >> n >> m;
  d.resize(n);
  rep(i, 0, n - 1) {
    cin >> d[i];
  }
  for (I i = 0; i < m; ++i) {
    I u, v;
    w_type w;
    cin >> u >> v;
    edges.emplace_back(u, v, 1);
    edges.emplace_back(v, u, 1);
  }
  for (const auto & e: edges) {
    adjacency_list[e.u].push_back(e);
  }

  VI min_ds, min_nodes;
  for (I i = 0; i < n; ++i) {
    if (color[i] == Color::kWhite) {
      int min_d = d[i], min_node = i;
      DFSVisit(i, min_d, min_node);
      min_ds.pb(min_d);
      min_nodes.pb(min_node);
    }
  }

  I nodes_need = 2 * (min_ds.size() - 1);
  if (n < nodes_need) {
    cout << "Impossible\n";
    return 0;
  } else if (nodes_need == 0) {
    cout << "0\n";
    return 0;
  }
  L ans = 0;
  I nodes_finished = 0;
  for (const auto & dm: min_ds) {
    ans += dm;
    ++nodes_finished;
  }
  sort(min_nodes.begin(), min_nodes.end(), greater<int>());
  for (const auto & nm: min_nodes) {
    d.erase(d.begin() + nm);
  }
  sort(d.begin(), d.end());
  rep(i, 0, nodes_need - nodes_finished - 1) {
    ans += d[i];
  }


  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10096