Problem: // We decided to drop the legend about the power sockets but feel free to come up with your own :^)

Define a chain: 

  * a chain of length 1 is a single vertex; 
  * a chain of length x is a chain of length x-1 with a new vertex connected to the end of it with a single edge. 



You are given n chains of lengths l_1, l_2, ..., l_n. You plan to build a tree using some of them.

  * Each vertex of the tree is either white or black. 
  * The tree initially only has a white root vertex. 
  * All chains initially consist only of white vertices. 
  * You can take one of the chains and connect any of its vertices to any white vertex of the tree with an edge. The chain becomes part of the tree. Both endpoints of this edge become black. 
  * Each chain can be used no more than once. 
  * Some chains can be left unused. 



The distance between two vertices of the tree is the number of edges on the shortest path between them.

If there is at least k white vertices in the resulting tree, then the value of the tree is the distance between the root and the k-th closest white vertex.

What's the minimum value of the tree you can obtain? If there is no way to build a tree with at least k white vertices, then print -1.

Input

The first line contains two integers n and k (1 ≤ n ≤ 2 ⋅ 10^5, 2 ≤ k ≤ 10^9) — the number of chains and the minimum number of white vertices a tree should have to have a value.

The second line contains n integers l_1, l_2, ..., l_n (3 ≤ l_i ≤ 2 ⋅ 10^5) — the lengths of the chains.

Output

Print a single integer. If there is no way to build a tree with at least k white vertices, then print -1. Otherwise, print the minimum value the tree can have.

Examples

Input


1 2
3


Output


2


Input


3 3
4 3 3


Output


3


Input


3 5
4 3 4


Output


4


Input


2 10
5 7


Output


-1

Note

<image>

You are allowed to not use all the chains, so it's optimal to only use chain of length 4 in the second example.

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class FPowerSockets {
        long[] tree;
        long[] lazy;

        void pushLazy(int n, int nL, int nR) {
            tree[n] += lazy[n] * (nR - nL + 1);
            if (nL != nR) {
                lazy[2 * n + 1] += lazy[n];
                lazy[2 * n + 2] += lazy[n];
            }
            lazy[n] = 0;
        }

        long query(int n, int nL, int nR, int l, int r) {
            pushLazy(n, nL, nR);
            if (nR < l || r < nL)
                return 0;
            if (l <= nL && nR <= r)
                return tree[n];
            return query(2 * n + 1, nL, (nL + nR) / 2, l, r) + query(2 * n + 2, (nL + nR) / 2 + 1, nR, l, r);
        }

        void update(int n, int nL, int nR, int l, int r, long v) {
            pushLazy(n, nL, nR);
            if (nR < l || r < nL)
                return;
            if (l <= nL && nR <= r) {
                lazy[n] += v;
                pushLazy(n, nL, nR);
                return;
            }
            update(2 * n + 1, nL, (nL + nR) / 2, l, r, v);
            update(2 * n + 2, (nL + nR) / 2 + 1, nR, l, r, v);
            tree[n] = tree[2 * n + 1] + tree[2 * n + 2];
        }

        public void solve(int testNumber, InputReader s, PrintWriter w) {
            int n = s.nextInt(), k = s.nextInt();
            Integer[] l = new Integer[n];
            for (int i = 0; i < n; i++)
                l[i] = s.nextInt();
            Arrays.sort(l);
            int ans = Integer.MAX_VALUE;
            int m = (int) 4e5;
            int limit = 0;
            tree = new long[4 * m];
            lazy = new long[4 * m];
            update(0, 0, m - 1, 0, 0, 1);
            int c = n - 1;
            for (int i = 0; i < m && c >= 0; i++) {
                long v = query(0, 0, m - 1, i, i);
                for (int j = 0; j < v && c >= 0; j++) {
                    int len = l[c];
                    update(0, 0, m - 1, i, i, -1);
                    update(0, 0, m - 1, i + 2, i + 2 + (len - 1) / 2 - 1, 2);
                    if (((len - 1) & 1) == 1)
                        update(0, 0, m - 1, i + 2 + (len - 1) / 2, i + 2 + (len - 1) / 2, 1);
                    limit = Math.max(i + 2 + (len - 1) / 2 - 1 + ((len - 1) & 1), limit);
                    c--;
                    int can = Integer.MAX_VALUE;
                    int left = i, right = limit;
                    while (left <= right) {
                        int mid = (left + right) / 2;
                        long val = query(0, 0, m - 1, i, mid);
                        if (val >= k) {
                            can = mid;
                            right = mid - 1;
                        } else
                            left = mid + 1;
                    }
                    ans = Math.min(can, ans);
                }
            }
            if (ans != Integer.MAX_VALUE)
                w.println(ans);
            else
                w.println(-1);
        }

    }

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

        public InputReader(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 interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}