Princess Heidi decided to give orders to all her K Rebel ship commanders in person. Unfortunately, she is currently travelling through hyperspace, and will leave it only at N specific moments t1, t2, ..., tN. The meetings with commanders must therefore start and stop at those times. Namely, each commander will board her ship at some time ti and disembark at some later time tj. Of course, Heidi needs to meet with all commanders, and no two meetings can be held during the same time. Two commanders cannot even meet at the beginnings/endings of the hyperspace jumps, because too many ships in one position could give out their coordinates to the enemy. 

Your task is to find minimum time that Princess Heidi has to spend on meetings, with her schedule satisfying the conditions above. 

Input

The first line contains two integers K, N (2 ≤ 2K ≤ N ≤ 500000, K ≤ 5000). The second line contains N distinct integers t1, t2, ..., tN (1 ≤ ti ≤ 109) representing the times when Heidi leaves hyperspace.

Output

Output only one integer: the minimum time spent on meetings. 

Examples

Input

2 5
1 4 6 7 12


Output

4


Input

3 6
6 3 4 2 5 1


Output

3


Input

4 12
15 7 4 19 3 30 14 1 5 23 17 25


Output

6

Note

In the first example, there are five valid schedules: [1, 4], [6, 7] with total time 4, [1, 4], [6, 12] with total time 9, [1, 4], [7, 12] with total time 8, [1, 6], [7, 12] with total time 10, and [4, 6], [7, 12] with total time 7. So the answer is 4.

In the second example, there is only 1 valid schedule: [1, 2], [3, 4], [5, 6].

For the third example, one possible schedule with total time 6 is: [1, 3], [4, 5], [14, 15], [23, 25].
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Comparator;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        E2 solver = new E2();
        solver.solve(1, in, out);
        out.close();
    }

    static class E2 {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int k = in.ni(), n = in.ni();
            int[] a = in.na(n);
            if (n > 1000) {
                ArrayUtils.randomShuffle(a);
            }
            Arrays.sort(a);
            Seg[] ss = new Seg[n - 1];
            for (int i = 0; i < n - 1; i++) {
                ss[i] = new Seg(a[i], a[i + 1]);
            }
            if (n > 1000) {
                ArrayUtils.randomShuffle(ss);
            }
            Arrays.sort(ss, Comparator.comparingInt((x) -> x.d));
            if (n > 1000) {
                Random r = new Random();
                int lim = Math.min(3 * k, n - 1);
                for (int i = 0; i < k; i++) {
                    int x = r.nextInt(lim);
                    int y = r.nextInt(lim - 1);
                    if (y >= x) y++;
                    Seg t = ss[x];
                    ss[x] = ss[y];
                    ss[y] = t;
                }
            }
            Arrays.sort(ss, 0, Math.min(3 * k, n - 1), Comparator.comparingInt((x) -> x.from));
            int[] b = new int[Math.min(6 * k, n)];
            Seg prev = ss[0];
            b[0] = prev.from;
            b[1] = prev.to;
            int bi = 2;
            for (int i = 1; i < Math.min(3 * k, n - 1); i++) {
                if (ss[i].from != prev.to) {
                    b[bi++] = ss[i].from;
                }
                b[bi++] = ss[i].to;
                prev = ss[i];
            }
            long[][] cur = new long[k + 1][2];
            long[][] nxt = new long[k + 1][2];
            for (int j = 0; j < k + 1; j++) {
                cur[j][0] = cur[j][1] = nxt[j][0] = nxt[j][1] = Long.MAX_VALUE;
            }

            cur[0][0] = 0;
            long ans = Long.MAX_VALUE;
            for (int i = 1; i < bi; i++) {
                for (int kk = 0; kk < k; kk++) {
                    nxt[kk][0] = Math.min(nxt[kk][0], cur[kk][1]);
                    if (cur[kk][0] != Long.MAX_VALUE) {
                        nxt[kk + 1][1] = Math.min(nxt[kk + 1][1], cur[kk][0] + b[i] - b[i - 1]);
                        nxt[kk][0] = Math.min(nxt[kk][0], cur[kk][0]);
                    }
                }
                ans = Math.min(ans, nxt[k][0]);
                ans = Math.min(ans, nxt[k][1]);
                long[][] tmp = cur;
                cur = nxt;
                nxt = tmp;
                for (int j = 0; j < k + 1; j++) {
                    nxt[j][0] = nxt[j][1] = Long.MAX_VALUE;
                }
            }
            out.println(ans);
        }

        class Seg {
            int from;
            int to;
            int d;

            public Seg(int from, int to) {
                this.from = from;
                this.to = to;
                d = to - from;
            }

        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(ns());
        }

        public int[] na(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = ni();
            return a;
        }

    }

    static class ArrayUtils {
        public static void randomShuffle(Object[] a) {
            Random rand = new Random();
            int n = a.length;
            for (int i = 0; i < n; i++) {
                int x = rand.nextInt(n);
                int y = rand.nextInt(n - 1);
                if (y >= x)
                    y++;
                Object t = a[x];
                a[x] = a[y];
                a[y] = t;
            }
        }

        public static void randomShuffle(int[] a) {
            Random rand = new Random();
            int n = a.length;
            for (int i = 0; i < n; i++) {
                int x = rand.nextInt(n);
                int y = rand.nextInt(n - 1);
                if (y >= x)
                    y++;
                int t = a[x];
                a[x] = a[y];
                a[y] = t;
            }
        }

    }
}

