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;

#define loop(i, l, r) for(int i = (int) l; i <= (int) r; i++)
#define rloop(i, r, l) for(int i = (int) r; i >= (int) l; i--)

#define vi vector<int> 
#define ii pair<int, int> 
#define eb emplace_back
#define all(x) begin(x), end(x)
#define fi first
#define se second

#define rand rng
#define endl '\n'
#define sp ' '


#define int long long
#define mid (l + r) / 2
const int maxN = 2e5 + 5, maxDist = 2e5 + 5;

int N, K;
int l[maxN];
struct segtree
{
	vi sum = vi(4 * maxDist + 5, 0);
	vi lz = vi(4 * maxDist + 5, 0);
	
	void pushDown(int i, int l, int r)
	{
		if(lz[i])
		{
			sum[i] += lz[i] * (r - l + 1);
			if(l < r) lz[2 * i] += lz[i], lz[2 * i + 1] += lz[i];
			lz[i] = 0;
		}
	}
	void add(int i, int l, int r, int ll, int rr, int val)
	{
		pushDown(i, l, r);
		if(ll > r or l > rr) return;
		if(ll <= l and r <= rr) 
		{
			lz[i] += val;
			pushDown(i, l, r);
		}
		else
		{
			add(2 * i, l, mid, ll, rr, val);
			add(2 * i + 1, mid + 1, r, ll, rr, val);
			sum[i] = sum[2 * i] + sum[2 * i + 1];
		}
	}
	int getf(int i, int l, int r)
	{
		pushDown(i, l, r);
		if(sum[i] == 0) return -1;
		if(l == r) return l;
		int t =  getf(2 * i, l, mid);
		if(t == -1) t = getf(2 * i + 1, mid + 1, r);
		return t;
	}
	int get(int i, int l, int r, int ll, int rr)
	{
		pushDown(i, l, r);
		if(l > rr or ll > r) return 0;
		if(ll <= l and r <= rr) return sum[i];
		return get(2 * i, l, mid, ll, rr) + get(2 * i + 1, mid + 1, r, ll, rr);
	}
	void clear()
	{
		fill(all(sum), 0);
		fill(all(lz), 0);
	}
} it;

signed main()
{
//		freopen("i.txt", "r", stdin);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> N >> K;
	loop(i, 1, N) cin >> l[i];
	int tot = 1;
	loop(i, 1, N) tot += l[i] - 2;
	if(tot < K) return cout << -1, 0;
	sort(l + 1, l + N + 1);
	int low = 0, high = maxDist - 1;
	while(low < high)
	{
		int m = (low + high) / 2;
		it.clear();
		it.add(1, 0, maxDist - 1, 0, 0, 1);
		rloop(i, N, 1)
		{
			int len = l[i];
			int d = it.getf(1, 0, maxDist - 1);
			if(d >= m - 1) break;
			it.add(1, 0, maxDist - 1, d, d, -1);
			it.add(1, 0, maxDist - 1, d + 2, d + (len - 1) / 2 + 1 , 1);
			it.add(1, 0, maxDist - 1, d + 2, d + len / 2 + 1, 1);
		}
		if(it.get(1, 0, maxDist - 1, 0, m) >= K) high = m;
		else low = m + 1;
	}
	cout << low;
}