using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;

namespace AtCoder
{
    class Node
    {
        public readonly int id;
        private Node parent;
        private List<Node> children;
        private int rank;
        public Node(int id)
        {
            this.id = id;
            parent = null;
            children = new List<Node>();
            rank = 0;
        }
        public Node Find()
        {
            if (parent != null)
            {
                var p = parent.Find();
                if (parent != p)
                {
                    p.children.Add(this);
                    parent = p;
                }
                return p;
            }
            else
            {
                return this;
            }
        }
        public static void Unite(Node a, Node b)
        {
            Node p = a.Find();
            Node q = b.Find();
            if (q.rank > p.rank)
            {
                q.children.Add(p);
                q.rank = Math.Max(p.rank + 1, q.rank);
                p.parent = q;
            }
            else
            {
                p.children.Add(q);
                p.rank = Math.Max(q.rank + 1, p.rank);
                q.parent = p;
            }
        }
    }
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        private static long? Solve(int N, long[] a, Node[] nodes)
        {
            var islands = new Dictionary<int, List<long>>();
            foreach (var node in nodes)
            {
                int id = node.Find().id;
                if (!islands.ContainsKey(id)) { islands[id] = new List<long>(); }
                islands[id].Add(a[node.id]);
            }
            int n = islands.Count;
            if (n == 1) { return 0; }
            long ans = 0;
            var values2 = new List<long>();
            foreach (var values1 in islands.Values)
            {
                values1.Sort();
                ans += values1[0];
                values2.AddRange(values1.Skip(1));
            }
            values2.Sort();
            if (values2.Count >= n - 2)
            {
                return ans + values2.Take(n - 2).Sum();
            }
            return null;
        }
        static void Main(string[] args)
        {
            int[] values1 = ReadInts();
            int N = values1[0];
            int M = values1[1];
            long[] a = ReadLongs();
            var nodes = new Node[N];
            for (int i = 0; i < N; ++i) { nodes[i] = new Node(i); }
            for (int i = 0; i < M; ++i)
            {
                int[] values2 = ReadInts();
                int x = values2[0];
                int y = values2[1];
                Node.Unite(nodes[x], nodes[y]);
            }
            long? ans = Solve(N, a, nodes);
            Console.WriteLine(ans.HasValue ? ans.Value.ToString() : "Impossible");
        }
    }
}


Measured memory_bytes: 47212