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 CPP):

Solution:
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
 
#define F first
#define S second
 
const int MOD = 1e9 + 7;//XXX
const int C = 26;//XXX
 
void add(int &x, int y){
	x += y;
	while (x >= MOD) x -= MOD;
	while (x < 0) x += MOD;
}
 
int fix(int x){
	while (x >= MOD) x -= MOD;
	while (x < 0) x += MOD;
	return x;
}
 
int pw(int a, int b){
	int ret = 1;
	while (b){
		if (b & 1)
			ret = 1ll*ret*a%MOD;
		b >>= 1;
		a = 1ll*a*a%MOD;
	}
	return ret;
}
 
const int MAXN = 5e5 + 10;

ll n, k, len[MAXN], st[MAXN<<2], lz[MAXN<<2];

void water(int i, int L, int R) {
	int m = (L + R)/2;
	st[i<<1] += lz[i] * (m - L + 1);
	lz[i<<1] += lz[i];
	st[i<<1^1] += lz[i] * (R - m);
	lz[i<<1^1] += lz[i];
	lz[i] = 0;
}

void plant(int i, int L, int R, int tl, int tr, ll x) {
	if(tl > tr)
		return;
	if(L == tl && R == tr) {
		st[i] += x * (R - L + 1);
		lz[i] += x;
		return;
	}
	water(i, L, R);
	int m = (L + R)/2;
	plant(i<<1, L, m, tl, min(tr, m), x);
	plant(i<<1^1, m+1, R, max(m+1, tl), tr, x);
	st[i] = st[i<<1] + st[i<<1^1];
}

ll smoke(int i, int L, int R, int tl, int tr) {
	if(tl > tr)
		return 0;
	if(L == tl && R == tr) {
		return st[i];
	}
	water(i, L, R);
	int m = (L+R)/2;
	return smoke(i<<1, L, m, tl, min(tr, m)) + smoke(i<<1^1, m+1, R, max(m+1, tl), tr);
}

void solve() {
	cin >> n >> k;
	ll tot = 0;
	for(int i = 0; i < n; i++) {
		cin >> len[i];
		tot += len[i];
	}
	if(tot - 2 * n + 1 < k) {
		cout << "-1\n";
		return;
	}
	sort(len, len+n);
	reverse(len, len+n);
	
	int ans = 1e9;
	plant(1, 0, MAXN-1, 0, 0, 1);
	
	for(int i = 0, h = 0; i < n; i++) {
		ll me = len[i];
		
		plant(1, 0, MAXN-1, h, h, -1);
		plant(1, 0, MAXN-1, h+2, h+1+(me-1)/2, 2);
		
		if(me % 2 == 0) 
			plant(1, 0, MAXN-1, h+1+me/2, h+1+me/2, 1);
				
		int v = 1, L = 0, R = MAXN-1; 
		ll want = k;
		while(want > 0) {
			if(L == R) {
				want -= st[v];
				break;
			}
			
			water(v, L, R);
			int m = (L + R)/2;
			if(st[v<<1] >= want) {
				v <<= 1;
				R = m;
			}
			else {
				want -= st[v<<1];
				v = v<<1^1;
				L = m+1;
			}
		}
		
		if(want <= 0) 
			ans = min(ans, R);

		while(smoke(1, 0, MAXN-1, h, h) == 0)
			h++;
	}
	
	assert(ans < 1e9);
	cout << ans << "\n";
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//cout << fixed << setprecision(6);
	
	int te = 1;	
	//cin >> te;
	for (int w = 1; w <= te; w++){
		//cout << "Case #" << w << ": ";
		solve();
	}
	return 0;
}