// Slower C++ solution:
#include<cstdio>

#include<cctype>

#include<cstring>

#include<algorithm>

#include<vector>

using std::vector;

#define max(a,b) (a>b?a:b)

#define min(a,b) (a<b?a:b)

#define reg register

typedef long long ll;

inline int read(){

    reg int x=0,f=1;reg char ch=getchar();

    for(;!isdigit(ch);f=ch=='-'?-1:1,ch=getchar());

    for(;isdigit(ch);x=x*10+(ch^48),ch=getchar());

    return x*f;

}

const int MN=1e5+5;

int n,m;

class UFset{

	public:

		int par[MN];

		inline int find(int x){return x==par[x]?x:par[x]=find(par[x]);}

		inline void init(int x){for(reg int i=0;i<x;i++)par[i]=i;}

		inline void unite(int x,int y){x=find(x);y=find(y);par[y]=x;}

		inline bool isfa(int x){return find(x)==x;}

}S;

int v[MN],cnt,id[MN],a[MN];

vector<int>pts[MN];

int main(){

	n=read();m=read();S.init(n);if(n==m+1)return 0*puts("0");

	for(reg int i=0;i<n;i++)v[i]=read();

	for(reg int i=1;i<=m;i++)S.unite(read(),read());

	for(reg int i=0;i<n;i++)if(S.isfa(i))id[i]=++cnt,pts[cnt].push_back(v[i]);

	for(reg int i=0;i<n;i++)if(!S.isfa(i))pts[id[S.find(i)]].push_back(v[i]);

	if(n<((cnt-1)<<1))return 0*puts("Impossible");

	for(reg int i=1;i<=cnt;i++)std::sort(pts[i].begin(),pts[i].end());

	reg ll ans=0;reg int tot=0;

	for(reg int i=1;i<=cnt;i++)ans+=pts[i][0];

	for(reg int i=1;i<=cnt;i++)for(reg int j=1;j<pts[i].size();j++)a[++tot]=pts[i][j];

	std::sort(a+1,a+1+tot);

	for(reg int i=1;i<=cnt-2;i++)ans+=a[i];

	printf("%lld\n",ans);

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.4506255172882727x):
#include <bits/stdc++.h>





using namespace std;

typedef long long LL;

const int maxn = 100005;

int a[maxn], fa[maxn], mi[maxn], id[maxn], vis[maxn];

int n, m;



void Init()

{

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

    {

        fa[i] = i;

        mi[i] = a[i];

        id[i] = i;

    }

}



int Find(int x)

{

    return fa[x] == x ? x : fa[x] = Find(fa[x]);

}



void Merge(int x, int y)

{

    int fx = Find(x), fy = Find(y);

    fa[fx] = fy;

    if(mi[fy] > mi[fx])

    {

        mi[fy] = mi[fx];

        id[fy] = id[fx];

    }

}



int main()

{

    scanf("%d%d", &n, &m);

    multiset<int> s;

    for(int i = 1; i <= n; i++)

    {

        scanf("%d", &a[i]);

        s.insert(a[i]);

    }

    Init();

//    multiset<int>::iterator it;

//    for(it = s.begin(); it != s.end(); it++)

//    {

//        printf("%d ", *it);

//    }

//    printf("\n");

    for(int i = 1; i <= m; i++)

    {

        int u, v;

        scanf("%d%d", &u, &v);

        Merge(u + 1, v + 1);

    }

    int num = 0;

    LL ans = 0;

    for(int i = 1; i <= n; i++)

    {

//        printf("%d %d %d\n", i, Find(i), mi[fa[i]]);

        if(Find(i) == i)

        {

            num++;

            ans += mi[fa[i]];

            multiset<int>::iterator it = s.find(mi[fa[i]]);

            s.erase(it);

        }

    }

    if(n < 2 * num - 2)

        printf("Impossible\n");

    else if(num == 1)

        printf("0\n");

    else

    {

        int cnt = 0;

        multiset<int>::iterator it;

        for(it = s.begin(); it != s.end() && cnt < num - 2; it++)

        {

            cnt++;

            ans += *it;

        }

        printf("%lld\n", ans);

    }

    return 0;

}