#include<bits/stdc++.h>
#define ll long long
using namespace std;

int n, m, aim, fa[101000], a[101000], id[101000], die[101000], sz[101000];
ll ans;

int GF(int x){
  return x==fa[x]? x: fa[x]=GF(fa[x]);
}

bool cmp(int x,int y){
  return a[x]<a[y];
}

int main(){
  cin>>n>>m; aim=(n-1-m)*2;
  for (int i=1;i<=n;++i) scanf("%d",&a[fa[i]=id[i]=i]);
  sort(id+1,id+n+1,cmp);
  int x, y, las=aim;
  for (;m--;){
    scanf("%d%d",&x,&y); ++x; ++y;
    fa[GF(x)]=GF(y);
  }
  for (int i=1;i<=n&&las;++i){
    x=id[i];
    if (sz[GF(x)]) continue;
    die[x]=1; ++sz[GF(x)]; ans+=a[x]; --las;
  }
  for (int i=1;i<=n&&las;++i){
    x=id[i];
    if (die[x]||(sz[GF(x)]+1)*2>aim) continue;
    die[x]=1; ++sz[GF(x)]; ans+=a[x]; --las;
  }
  if (las) return 0*puts("Impossible");
  cout<<ans<<endl;
}