You are given an array a_1, a_2, ..., a_n and an integer k.

You are asked to divide this array into k non-empty consecutive subarrays. Every element in the array should be included in exactly one subarray. Let f(i) be the index of subarray the i-th element belongs to. Subarrays are numbered from left to right and from 1 to k.

Let the cost of division be equal to ∑_{i=1}^{n} (a_i ⋅ f(i)). For example, if a = [1, -2, -3, 4, -5, 6, -7] and we divide it into 3 subbarays in the following way: [1, -2, -3], [4, -5], [6, -7], then the cost of division is equal to 1 ⋅ 1 - 2 ⋅ 1 - 3 ⋅ 1 + 4 ⋅ 2 - 5 ⋅ 2 + 6 ⋅ 3 - 7 ⋅ 3 = -9.

Calculate the maximum cost you can obtain by dividing the array a into k non-empty consecutive subarrays. 

Input

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 3 ⋅ 10^5).

The second line contains n integers a_1, a_2, ..., a_n ( |a_i| ≤ 10^6). 

Output

Print the maximum cost you can obtain by dividing the array a into k nonempty consecutive subarrays. 

Examples

Input


5 2
-1 -2 5 -4 8


Output


15


Input


7 6
-3 0 -1 -2 -2 -4 -1


Output


-45


Input


4 1
3 -1 6 0


Output


8
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Collections;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author caoash
 */
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);
        DArraySplitting solver = new DArraySplitting();
        solver.solve(1, in, out);
        out.close();
    }

    static class DArraySplitting {
        public void solve(int testNumber, FastScanner br, PrintWriter pw) {
            int n = br.nextInt();
            int k = br.nextInt();
            int[] a = br.nextIntArray(n);
            long[] suf = new long[n];
            suf[0] = a[n - 1];
            for (int i = 1; i < n; i++) {
                suf[i] = suf[i - 1] + a[n - 1 - i];
            }
            ArrayList<Pair> sort = new ArrayList<>();
            for (int i = 0; i < suf.length; i++) {
                if (n - (i + 1) == 0) {
                    continue;
                }
                sort.add(new Pair(suf[i], n - (i + 1)));
            }
            Collections.sort(sort);
            Collections.reverse(sort);
            long ans = 0;
            ArrayList<Pair2> sort2 = new ArrayList<>();
            for (int i = 0; i < k - 1; i++) {
                sort2.add(new Pair2(sort.get(i).s, sort.get(i).f));
            }
            Collections.sort(sort2);
            if (sort2.isEmpty()) {
                for (int i = 0; i < n; i++) {
                    ans += (long) a[i];
                }
                pw.println(ans);
                pw.close();
            } else {
                Pair2 curr = sort2.get(0);
                long sum = 0;
                int nc = 1;
                int p = 0;
                for (int i = 0; i < n; i++) {
                    if (i == curr.f) {
                        ans += (sum * (long) nc);
                        nc++;
                        p++;
                        if (p >= sort2.size()) {
                            curr = new Pair2(n, 0);
                        } else {
                            curr = sort2.get(p);
                        }
                        sum = 0;
                    }
                    sum += (long) a[i];
                }
                ans += (sum * (long) nc);
                pw.println(ans);
            }
        }

        public class Pair implements Comparable<Pair> {
            long f;
            int s;

            public Pair(long f, int s) {
                this.f = f;
                this.s = s;
            }

            public int compareTo(Pair p) {
                return this.f == p.f ? this.s - p.s : Long.compare(this.f, p.f);
            }

        }

        public class Pair2 implements Comparable<Pair2> {
            int f;
            long s;

            public Pair2(int f, long s) {
                this.f = f;
                this.s = s;
            }

            public int compareTo(Pair2 p) {
                return this.f == p.f ? Long.compare(this.s, p.s) : this.f - p.f;
            }

        }

    }

    static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastScanner.SpaceCharFilter filter;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] nextIntArray(int n) {
            int[] array = new int[n];
            for (int i = 0; i < n; ++i) array[i] = nextInt();
            return array;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

