void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.exception, std.typecons;
  
  int n, m; rd(n, m);
  auto a=readln.split.to!(long[]);
  auto g=new int[][](n);
  foreach(i; 0..m){
    int x, y; rd(x, y);
    g[x]~=y; g[y]~=x;
  }

  if(m==n-1){writeln(0); return;}
  if((n-m-1)*2>n){writeln("Impossible"); return;}

  auto vis=new bool[](n);
  long dfs(int i, int p=-1){
    vis[i]=true;
    auto ret=a[i];
    foreach(j; g[i])if(j!=p){
      ret=min(ret, dfs(j, i));
    }
    return ret;
  }
  auto used=new bool[](n);
  bool search(long mn, int i, int p=-1){
    if(a[i]==mn){used[i]=true; return true;}
    auto ret=false;
    foreach(j; g[i])if(j!=p){
      ret|=search(mn, j, i);
      if(ret) return true;
    }
    return ret;
  }

  long c=0;
  foreach(i; 0..n)if(vis[i]==false){
    auto cost=dfs(i), found=search(cost, i);
    enforce(found);
    c+=cost;
  }
  alias T=Tuple!(long, "a", int, "i");
  auto as=new T[](n);
  foreach(i; 0..n) as[i]=T(a[i], i);
  sort!((l, r)=>(l.a==r.a ? l.i<r.i : l.a<r.a))(as);
  int tot=n-m, j=0;
  while(tot<(n-m-1)*2){
    auto e=as[j++];
    if(used[e.i]) continue;
    c+=e.a; tot++;
  }

  writeln(c);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
