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

using namespace std;



typedef long long ll;



const int maxn = 1e5 + 5;



int n, m, k;

int w[maxn], f[maxn];

ll ans;

priority_queue <int, vector<int>, greater<int>> q[maxn];

multiset <int> s;



int find(int x)

{

	return f[x] == x ? x : f[x] = find(f[x]);

}



void merge(int x, int y)

{

	int fx = find(x);

	int fy = find(y);

	if(fx != fy)

		f[fx] = fy;

}



int main()

{

	int u, v;

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

	k = n - m;

	if(2 * k - 2 > n)

	{

		puts("Impossible");

		return 0;

	}

	if(k == 1)

	{

		puts("0");

		return 0;

	}

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

	{

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

		f[i] = i;

	}

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

	{

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

		u++, v++;

		merge(u, v);

	}

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

	{

		find(i);

		q[f[i]].push(w[i]);

	}

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

		if(!q[i].empty())

		{

			ans += q[i].top();

			q[i].pop();

	//		printf("val = %lld\n", val);

		}

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

		while(!q[i].empty())

		{

			s.insert(q[i].top());

			q[i].pop();

		}	

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

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

	auto it = s.begin();

	for(int i = 1; i <= k - 2; i++, it++)

	{

		ans += *it;

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

	}

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

	return 0;

}

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

#include<cstdio>

#include<cstring>

#include<vector>



const int Maxv = 100020, INF = 0x7fffffff; 

std::vector<int> g[Maxv]; 

int v[Maxv], fa[Maxv], idx[Maxv], cnt, n, m; 

long long ans; 

bool vis[Maxv]; 



inline int read(){

    int x = 0, f = 1; 

    char ch = getchar(); 

    while (ch < '0' || ch > '9') {

        if (ch == '-') {

            f = -1; 

        }

        ch = getchar(); 

    }

    while (ch >= '0' && ch <= '9') {

        x = (x << 3) + (x << 1) + ch - '0'; 

        ch = getchar();

    }

    return x * f; 

}



bool cmp(int a, int b){

    return v[a] < v[b]; 

}



inline int find(int x){

    if (fa[x] == x) {

        return x; 

    }

    else {

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

    }

    return fa[x]; 

}



inline void merge(int u, int v){

    int fu = find(u); 

    int fv = find(v); 

    if (fu != fv) {

        fa[fu] = fv; 

    }

    cnt++; 

}



int main(){

    n = read();

    m = read(); 

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

        v[i] = read(); 

        fa[i] = i; 

    }

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

        int u = read() + 1; 

        int v = read() + 1; 

        merge(u, v); 

    }

    if (cnt == n - 1) {

        printf("0"); 

        return 0; 

    }

    int k = (n - 1 - cnt) << 1; 

    if (k > n) {

        printf("Impossible"); 

        return 0; 

    }

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

        idx[i] = i; 

    }

    std::sort(idx + 1, idx + n + 1, cmp); 

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

        int fi = find(i); 

        g[fi].push_back(i); 

    }

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

        if (i == fa[i]) {

            int Min = INF;

            int Index; 

            for (int j = 0; j < g[i].size(); j++) {

                if (v[g[i][j]] < Min) {

                    Min = v[ g[i][j] ]; 

                    Index = g[i][j]; 

                }

            } 

            ans += Min; 

            vis[Index] = true; 

            k--; 

        }

    }

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

        if (k && !vis[ idx[i] ]) {

            ans += v[ idx[i] ]; 

            vis[ idx[i] ] = true; 

            k--; 

        }

    }

    printf("%lld", ans); 

    return 0; 

}