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.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.stream.Stream;
import java.util.Iterator;
import java.util.List;
import java.util.Map;


public class Main {
	
	
static class SegTree {
	
	int l, r;
	int toProp;
	long rangeSum;
	SegTree lChild, rChild;
	
	public SegTree(int l, int r) {
		
		this.l = l;
		this.r = r;
		
		if(l != r) {
			int mid = (l + r) >> 1;
			lChild = new SegTree(l, mid);
			rChild = new SegTree(mid + 1, r);
			recalculate();
		}
		
	}
	
	public void recalculate() {
		if(l != r)
				rangeSum = lChild.rangeSum() + rChild.rangeSum();
	}
	
	public long rangeSum() {
		return rangeSum + 1l * toProp * (r - l + 1);
	}
	
	public void prop() {
		
		if(l == r) {
			rangeSum += toProp;
		}
		
		else {
			lChild.toProp += toProp;
			rChild.toProp += toProp;
		}
		
		toProp = 0;
		recalculate();
	}
	
	public void rangeAdd(int ql, int qr, long val) {
		
		prop();
		
		if(ql <= l && qr >= r) {
			toProp += val;
			return;
		}
		
		if(ql > r || qr < l) {
			return;
		}
		
		lChild.rangeAdd(ql, qr, val);
		rChild.rangeAdd(ql, qr, val);
		recalculate();
		
	}
	
	public int minNonZeroIndex() {
		
		prop(); 
		
		if(rangeSum() == 0) return -1;
		
		if(l == r) {
			return l;
		}
		
		if(lChild.rangeSum() != 0) return lChild.minNonZeroIndex();
		return rChild.minNonZeroIndex();
		
	}
	
	public int whenDoesPrefixHitK(long K) {
		
		prop();
		
		if(rangeSum() < K) return -1;
		
		if(l == r) {
			return l;
		}
		
		if(lChild.rangeSum() >= K) {
			return lChild.whenDoesPrefixHitK(K);
		}
		
		K -= lChild.rangeSum();
		return rChild.whenDoesPrefixHitK(K);
		
		
	}
	
	
}

	

public static void main(String[] args){
 
   new Thread(null, null, "Anshum Gupta", 99999999) {
        public void run() {
            try {
                solve();
            } catch(Exception e) {
                e.printStackTrace();
                System.exit(1);
            }
        }
    }.start();
}
 

static final long INF_LONG = (long)(1e18 + 5), MOD = (long)1e9 + 7;//998244353; 
static final int MXN = (int)(1001), MXV = (int)(2e5 + 5), log = 18, INF = (int)1e9 + 500;
static boolean[] vis;
static ArrayList<ArrayList<Integer>> adj;
static int N, M, K, Q, H, W;
static char[] S;



public static void solve() throws Exception {
	   // solve the problem here
		s = new MyScanner();
   		out = new MyWriter(new BufferedOutputStream(System.out));
   		
        int tc = 1;//s.nextInt();   
    	for(int i=1; i<=tc; i++) {
    		testcase();
    	}
          
        out.flush();
        out.close();
}



static void testcase() {
	
	int N = s.nextInt(), K = s.nextInt();
	int[] L = s.nextIntArray(N);
	
	// no of white vertices = sum(lengths of chain taken) - numChains * 2 - 1
	// and at any point num of white vertices > 0
	// all whites should be as close as possible
	// at least the K whites should be as close
	
	// for each range I have some number of whites in that range
	// I need to pick some whites from it
	
	shuffleSort(L);
	
	SegTree st = new SegTree(0, MXV);
	int best = -1;
	best = check(best, st, K);
	st.rangeAdd(0, 0, 1);
	
	for(int i = N - 1; i >= 0; i--) {
		
		int minIndex = st.minNonZeroIndex();
		st.rangeAdd(minIndex, minIndex, -1);
		int left = L[i] / 2;
		int right = L[i] - left - 1;
		int minHeight = minIndex + 2;
		st.rangeAdd(minHeight, minHeight + left - 1, 1);
		st.rangeAdd(minHeight, minHeight + right - 1, 1);
		best = check(best, st, K);
		
	}	
	
	out.println(best);
	
	
		
}


static int check(int best, SegTree st, long K) {
	
	if(st.rangeSum() < K) return best;
	
	int first = st.whenDoesPrefixHitK(K);
	return best == -1 ? first : Math.min(best, first);
	
}






public static MyWriter out;
public static MyScanner s;
static void shuffleArray(int[] a) {
	Random random = new Random();
	for (int i = a.length-1; i > 0; i--) {
		int index = random.nextInt(i + 1);
		int tmp = a[index];
		a[index] = a[i];
		a[i] = tmp;
	}
}
static void shuffleSort(int[] a) {
	shuffleArray(a);
	Arrays.parallelSort(a);
}

static void shuffleArray(long[] a) {
	Random random = new Random();
	for (int i = a.length-1; i > 0; i--) {
		int index = random.nextInt(i + 1);
		long tmp = a[index];
		a[index] = a[i];
		a[i] = tmp;
	}
}
static void shuffleSort(long[] a) {
	shuffleArray(a);
	Arrays.parallelSort(a);
}

static class MyScanner {
 
    BufferedReader br;
    StringTokenizer st;
 
    public MyScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }
    public MyScanner(String fileName) {
    	try {
			br = new BufferedReader(new FileReader(fileName));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
    }
    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
 
    int nextInt() { return Integer.parseInt(next()); }
    long nextLong() { return Long.parseLong(next()); }
    double nextDouble() { return Double.parseDouble(next()); }
    int[] nextIntArray(int n){
    	int[]a = new int[n];
    	for(int i=0; i<n; i++) {
    		a[i] = this.nextInt();
    	}
    	return a;
    }
    long[] nextlongArray(int n) {
    	long[]a = new long[n];
    	for(int i=0; i<n; i++) {
    		a[i] = this.nextLong();
    	}
    	return a;
    }
    Integer[] nextIntegerArray(int n){
    	Integer[]a = new Integer[n];
    	for(int i=0; i<n; i++) {
    		a[i] = this.nextInt();
    	}
    	return a;
    }
    Long[] nextLongArray(int n) {
    	Long[]a = new Long[n];
    	for(int i=0; i<n; i++) {
    		a[i] = this.nextLong();
    	}
    	return a;
    }
    char[][] next2DCharArray(int n, int m){
    	char[][]arr = new char[n][m];
    	for(int i=0; i<n; i++) {
    		arr[i] = this.next().toCharArray();
    	}
    	return arr;
    }
    ArrayList<ArrayList<Integer>> readUndirectedUnweightedGraph(int n, int m) {
    	ArrayList<ArrayList<Integer>>adj = new ArrayList<ArrayList<Integer>>();
    	for(int i=0; i<=n; i++)adj.add(new ArrayList<Integer>());
    	for(int i=0; i<m; i++) {
    		int u = s.nextInt();
    		int v = s.nextInt();
    		adj.get(u).add(v);
    		adj.get(v).add(u);
    	}
    	return adj;
    }
    ArrayList<ArrayList<Integer>> readDirectedUnweightedGraph(int n, int m) {
    	ArrayList<ArrayList<Integer>>adj = new ArrayList<ArrayList<Integer>>();
    	for(int i=0; i<=n; i++)adj.add(new ArrayList<Integer>());
    	for(int i=0; i<m; i++) {
    		int u = s.nextInt();
    		int v = s.nextInt();
    		adj.get(u).add(v);
    	}
    	return adj;
    }
    String nextLine(){
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}
 
static class MyWriter extends PrintWriter {
    MyWriter(OutputStream out) {
        super(out);
    }
    void println(int[] x) {
        println(x, " ");
    }
    void println(int[] x, String delimiter) {
        if (x.length > 0) {
            print(x[0]);
            for (int i = 1; i < x.length; i++) {
                print(delimiter);
                print(x[i]);
            }
        }
        println();
    }
    void println(long[] x) {
        println(x, " ");
    }
    void println(long[] x, String delimiter) {
        if (x.length > 0) {
            print(x[0]);
            for (int i = 1; i < x.length; i++) {
                print(delimiter);
                print(x[i]);
            }
        }
        println();
    }
    void println(Iterable<?> iterable) {
        println(iterable, " ");
    }
    void println(Iterable<?> iterable, String delimiter) {
        Iterator<?> i = iterable.iterator();
        if (i.hasNext()) {
            print(i.next());
            while (i.hasNext()) {
                print(delimiter);
                print(i.next());
            }
        }
        println();
    }
    void printLines(int[] x) {
        println(x, System.lineSeparator());
    }
    void printLines(long[] x) {
        println(x, System.lineSeparator());
    }
    void printLines(Iterable<?> iterable) {
        println(iterable, System.lineSeparator());
    }
}
 
}