// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



const int MAXN = 101010;



int a[MAXN];



class Node {

public:

	int v;

	Node *l, *r;

	int key;

	

	Node(int x) {

		v = a[x];

		l = r = 0;

		key = 1;

	}

};



//set<pair<int,int> > s;



class Road {

public:

	int t, next;

}e[MAXN * 2];

int p[MAXN];

int z = -1;



int vis[MAXN];



void add(int u, int v) {

	++z;

	e[z].t = v;

	e[z].next = p[u];

	p[u] = z;

}



Node *root[MAXN];



int getkey(Node *now) {

	return now ? now->key : 0;

}



void update(Node *now) {

	now->key = getkey(now->r) + 1;

}



Node* merge(Node *&l, Node *&r) {

	if(!l)

		return r;

	if(!r)

		return l;

//	cout<<l->v<<" "<<r->v<<endl;

	if(l->v < r->v) {

		l->r = merge(l->r, r);

		if(getkey(l->l) < getkey(l->r))

			swap(l->l, l->r);

		update(l);

		return l;

	}

	else {

		r->r = merge(l, r->r);

		if(getkey(r->l) < getkey(r->r))

			swap(r->l, r->r);

		update(r);

		return r;

	}

}



void dfs(int u, int fa, int tag) {

	vis[u] = tag;

	if(u != tag) {

		root[tag] = merge(root[tag], root[u]);

		root[u] = 0;

	}

	for(int tmp = p[u]; tmp != -1; tmp = e[tmp].next) {

		if(e[tmp].t != fa) {

			dfs(e[tmp].t, u, tag);

		}

	}

} 



void del(Node *&now) {

	//print(now);

	now = merge(now->l, now->r);

}





int n, m;



int main() {

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

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

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

		root[i] = new Node(i);

	}

	int u, v;

	memset(p, -1, sizeof(p));

	

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

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

		add(u, v);

		add(v, u);

	}

	memset(vis, -1, sizeof(vis));

	

	int cnt = 0;

	long long ss = 0;

	Node *tmp = 0;

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

		if(vis[i] == -1) {

			++cnt;

			dfs(i, -1, i);

			ss += root[i]->v;

			del(root[i]);

			tmp = merge(tmp, root[i]);

		}

	}

	if((n - 1 - m) * 2 > n) {

		puts("Impossible");

		return 0;

	}

	if(m == n - 1) {

		puts("0");

		return 0;

	}

	

	int need = (n - 1 - m) * 2 - cnt;

	for(int i = 1; i <= need; ++i) {

		ss += tmp->v;

		del(tmp);

	}

	

	//if(cnt >= n - 1) {

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

	//}

	/*else {

		puts("Impossible");

	}*/



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 9.475027731673286x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define maxn 100005

#define LL long long

using namespace std;

int n,m,fa[maxn],use[maxn],cnt;

LL ans;

struct node { int w;bool vis; } a[maxn];

bool cmp(node p,node q) 

{

	if(p.vis) return false;

	if(q.vis) return true;

	return p.w<q.w; 

}

int find(int x)

{

	if(fa[x]==x) return x;

	return fa[x]=find(fa[x]);

}

int main()

{

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

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

	{

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

		fa[i]=i;use[i]=i;

		a[i].vis=true;

	}

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

	{

		int u,v;

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

		u++,v++;

		int r1=find(u),r2=find(v);

		if(r1!=r2)

		{

			if(a[use[r2]].w<a[use[r1]].w)

			{

				a[use[r1]].vis=false;

				use[r1]=use[r2];

			}

			else a[use[r2]].vis=false;

			fa[r2]=r1;

		}

	}

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

		if(find(i)==i) 

		{

			ans+=1ll*a[use[i]].w;

			cnt++;

		}

	if(cnt==1)

	{

		printf("0\n");

		return 0;

	}

	sort(a+1,a+n+1,cmp);

	for(int i=1;i<=cnt-2;i++)

		if(a[i].vis)

		{

			printf("Impossible\n");

			return 0;

		}

		else ans+=1ll*a[i].w;

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

}