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.awt.*;
import java.io.*;
import java.util.List;

public class Coding {

    private static BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
    private static BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
    static long[] segmentTree = new long[4 * 200000 + 5];
    static long[] lazy = new long[4 * 200000 + 5];

    public static void main(String[] args) {
        try {
            run();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void run() throws Exception {
        InputModule inp = new InputModule();
        OutputModule out = new OutputModule();
        int t = 1;
        while (t > 0) {
            int[] ints = inp.cinIntArray(2);
            int n = ints[0];
            long k = ints[1];
            int[] ar = inp.cinIntArray(n);
            mergeSort(ar, 0, n - 1);
            long sum = 0;
            for (int i = 0; i < n; ++i) {
                sum += ar[i];
            }
            sum -= (2 * n - 1);
            if (sum >= k) {
                buildTree(0, 0, 199999);
                long whites = 0;
                long ans = k;
                updateTree(0, 0, 199999, 0, 0, 1);
                for (int i = n - 1; i >= 0; --i) {
                    int cur = (i == n - 1) ? (ar[i] - 1) : (ar[i] - 2);
                    whites += cur;
                    int first = query(0, 0, 199999, 1);
                    //System.out.println("First is " + first);
                    updateTree(0, 0, 199999, first, first, -1);
                    int start = first + 2;
                    int end = first + (ar[i] / 2);
                    //System.out.println("Start is " + start + " end is " + end);
                    if (start <= end) {
                        updateTree(0, 0, 199999, start, end, 2);
                    }
                    updateTree(0, 0, 199999, end + 1, end + 1, (ar[i] % 2 == 0) ? 1 : 2);
                    if (whites < k) continue;
                    int kth = query(0, 0, 199999, k);
                    ans = Math.min(ans, kth);
                }
                out.printLong(ans);
            } else {
                out.printInt(-1);
            }
            t--;
        }
    }

    private static void buildTree(int idx, int l, int r) {
        if (l == r) {
            segmentTree[idx] = lazy[idx] = 0;
        } else {
            int mi = (l + r) / 2;
            buildTree(2 * idx + 1, l, mi);
            buildTree(2 * idx + 2, mi + 1, r);
            segmentTree[idx] = segmentTree[2 * idx + 1] + segmentTree[2 * idx + 2];
        }
    }

    private static void updateTree(int idx, int l, int r, int ql, int qr, long val) {
        if (lazy[idx] != 0) {
            segmentTree[idx] += (lazy[idx] * (r - l + 1));
            if (l != r) {
                lazy[2 * idx + 1] += lazy[idx];
                lazy[2 * idx + 2] += lazy[idx];
            }
            lazy[idx] = 0;
        }
        if (ql > r || qr < l) return;
        if (l == r) {
            segmentTree[idx] = segmentTree[idx] + val;
        } else if (ql <= l && qr >= r) {
            segmentTree[idx] += (val * (r - l + 1));
            lazy[2 * idx + 1] += val;
            lazy[2 * idx + 2] += val;
        } else {
            int mi = (l + r) / 2;
            updateTree(2 * idx + 1, l, mi, ql, qr, val);
            updateTree(2 * idx + 2, mi + 1, r, ql, qr, val);
            segmentTree[idx] = segmentTree[2 * idx + 1] + segmentTree[2 * idx + 2];
        }
    }

    private static int query(int idx, int l, int r, long k) {
        if (lazy[idx] != 0) {
            segmentTree[idx] += (lazy[idx] * (r - l + 1));
            if (l != r) {
                lazy[2 * idx + 1] += lazy[idx];
                lazy[2 * idx + 2] += lazy[idx];
            }
            lazy[idx] = 0;
        }
        if (l == r) return l;
        int mid = (l + r) / 2;
        long leftVal = segmentTree[2 * idx + 1] + (mid - l + 1) * lazy[2 * idx + 1];
        if (leftVal >= k) {
            return query(2 * idx + 1, l, mid, k);
        }
        return query(2 * idx + 2, mid + 1, r, k - leftVal);
    }

    private static void mergeSort(int[] ar, int st, int en) {
        if (st >= en) {
            return;
        }
        int mi = (st + en) / 2;
        mergeSort(ar, st, mi);
        mergeSort(ar, mi + 1, en);
        int[] tmp = new int[en - st + 1];
        int p1 = st;
        int p2 = mi + 1;
        int cur = 0;
        while (p1 <= mi && p2 <= en) {
            if (ar[p1] <= ar[p2]) {
                tmp[cur] = ar[p1];
                cur++;
                p1++;
            } else {
                tmp[cur] = ar[p2];
                cur++;
                p2++;
            }
        }

        while (p1 <= mi) {
            tmp[cur] = ar[p1];
            cur++;
            p1++;
        }

        while (p2 <= en) {
            tmp[cur] = ar[p2];
            cur++;
            p2++;
        }

        for (int i = st; i <= en; ++i) {
            ar[i] = tmp[i - st];
        }
    }

    private static class InputModule {
        private int cinInt() throws Exception {
            return Integer.parseInt(bi.readLine().split(" ")[0].trim());
        }

        private long cinLong() throws Exception {
            return Long.parseLong(bi.readLine().split(" ")[0].trim());
        }

        private Double cinDouble() throws Exception {
            return Double.parseDouble(bi.readLine().split(" ")[0].trim());
        }

        private String cinString() throws Exception {
            return bi.readLine();
        }

        private int[] cinIntArray(int n) throws Exception {
            String input = bi.readLine();
            String[] values = input.split(" ");
            int[] ar = new int[n];
            for (int i = 0; i < n; ++i) {
                ar[i] = Integer.parseInt(values[i]);
            }
            return ar;
        }

        private int[] cinIntArray() throws Exception {
            String input = bi.readLine();
            String[] values = input.split(" ");
            int[] ar = new int[values.length];
            for (int i = 0; i < values.length; ++i) {
                ar[i] = Integer.parseInt(values[i]);
            }
            return ar;
        }

        private long[] cinLongArray(int n) throws Exception {
            String input = bi.readLine();
            String[] values = input.split(" ");
            long[] ar = new long[n];
            for (int i = 0; i < n; ++i) {
                ar[i] = Long.parseLong(values[i]);
            }
            return ar;
        }

        private String[] cinStringArray(int n) throws Exception {
            return bi.readLine().split(" ");
        }
    }

    private static class OutputModule {
        private void printInt(int ans) throws Exception {
            writer.append(ans + "\n");
            writer.flush();
        }

        private void printLong(long ans) throws Exception {
            writer.append(ans + "\n");
            writer.flush();
        }

        private void printDouble(Double ans) throws Exception {
            writer.append(String.format("%.10f", ans));
            writer.append("\n");
            writer.flush();
        }

        private void printString(String ans) throws Exception {
            writer.append(ans + "\n");
            writer.flush();
        }

        private void printIntArray(int[] ans) throws Exception {
            for (int i = 0; i < ans.length; ++i) {
                writer.append(ans[i] + " ");
            }
            writer.append("\n");
            writer.flush();
        }

        private void printLongArray(long[] ans) throws Exception {
            for (int i = 0; i < ans.length; ++i) {
                writer.append(ans[i] + " ");
            }
            writer.append("\n");
            writer.flush();
        }

        private void printIntMatrix(int[][] mat, int n, int m) throws Exception {
            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < m; ++j) {
                    writer.append(mat[i][j] + " ");
                }
                writer.append("\n");
            }
            writer.flush();
        }

        private void printLongMatrix(long[][] mat, int n, int m) throws Exception {
            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < m; ++j) {
                    writer.append(mat[i][j] + " ");
                }
                writer.append("\n");
            }
            writer.flush();
        }

        private void printPoint(Point p) throws Exception {
            writer.append(p.x + " " + p.y + "\n");
            writer.flush();
        }

        private void printPoints(List<Point> p) throws Exception {
            for (Point pp : p) {
                writer.append(pp.x + " " + pp.y + "\n");
            }
            writer.flush();
        }
    }
}