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:
// "Software is like sex: it's better when it's free" - Linus Torvalds
// "First, solve the problem. Then, write the code." - John Johnson
// "Hardware : the parts of a computer system that can be kicked." - Jeff Pesis
// "Simplicity is prerequisite for reliability." - Edsger W. Dijkstra

#include <limits>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <iostream>
#include <climits>
#include <cstdlib>
#include <iterator>
#include <tuple>
#include <utility>
#include <iomanip>
#include <list>
#include <queue>
#include <stack>
#include <cfloat>

using namespace std;
#define int long long // remember to make constants use the LL suffix
// int mox = 1e9 + 7;
// #define maxheap(x) priority_queue<(x)>;
// #define minheap(x) priority_queue<(x), vector<x>, greater<(x)>>;
// date : 09/01/2021
// time : 02:58:11
// numeric_limits
#define deb(x) cout << #x << " = " << x << endl;

int n, k;
vector<int> v, lazy, tree;

void build(int pos, int l, int r)
{
	if (l > r)
		return;
	if (l == r)
	{
		tree[pos] = v[l];
		return;
	}
	int mid = l + (r - l) / 2;
	build(2 * pos, l, mid);
	build(2 * pos + 1, mid + 1, r);
	tree[pos] = tree[2 * pos] + tree[2 * pos + 1];
}

void update(int pos, int l, int r, int ul, int ur, int inc)
{
	if (l > ur || r < ul)
		return;
	if (l >= ul && r <= ur)
	{
		lazy[pos] += inc;
		tree[pos] += lazy[pos] * (r - l + 1);
		if (l != r)
		{
			lazy[2 * pos] += lazy[pos];
			lazy[2 * pos + 1] += lazy[pos];
		}
		lazy[pos] = 0;
		return;
	}
	// tree[pos] += lazy[pos] * (r - l + 1);
	lazy[2 * pos] += lazy[pos];
	lazy[2 * pos + 1] += lazy[pos];
	lazy[pos] = 0;
	int mid = l + (r - l) / 2;
	update(2 * pos, l, mid, ul, ur, inc);
	update(2 * pos + 1, mid + 1, r, ul, ur, inc);
	tree[pos] = tree[2 * pos] + tree[2 * pos + 1] + lazy[2 * pos] * (mid - l + 1) + lazy[2 * pos + 1] * (r - mid);
}

int query(int pos, int l, int r, int ql, int qr)
{
	if (l > qr || r < ql)
		return 0;
	if (l >= ql && r <= qr) // complete overlap
	{
		tree[pos] += lazy[pos] * (r - l + 1);
		if (l != r)
		{
			lazy[2 * pos] += lazy[pos];
			lazy[2 * pos + 1] += lazy[pos];
		}
		lazy[pos] = 0;
		return tree[pos];
	}
	tree[pos] += lazy[pos] * (r - l + 1);
	lazy[2 * pos] += lazy[pos];
	lazy[2 * pos + 1] += lazy[pos];
	lazy[pos] = 0;
	int mid = l + (r - l) / 2;
	return query(2 * pos, l, mid, ql, qr) + query(2 * pos + 1, mid + 1, r, ql, qr);
}

int finder(int pos, int l, int r, int target)
{
	if (l == r)
		return l;
	if (lazy[pos])
	{
		tree[pos] += lazy[pos] * (r - l + 1);
		lazy[2 * pos] += lazy[pos];
		lazy[2 * pos + 1] += lazy[pos];
		lazy[pos] = 0;
	}
	int mid = l + (r - l) / 2;
	int left = tree[2 * pos] + lazy[2 * pos] * (mid - l + 1);
	int right = tree[2 * pos] + lazy[2 * pos] * (r - mid);

	if (left >= target)
		return finder(2 * pos, l, mid, target);
	else
		return finder(2 * pos + 1, mid + 1, r, target - left);
}

int32_t main()
{
#ifdef LOCAL_ABHAY
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t, i, j, m, q;
	string s;
	t = 1;
	while (t--)
	{
		cin >> n;
		cin >> k;

		int vec_size = 1e6;
		v.assign(vec_size, 0);
		tree.assign(4 * vec_size, 0);
		lazy.assign(4 * vec_size, 0);
		for (i = 0; i < n; i++)
			cin >> v[i];

		sort(v.rbegin(), v.rend());

		int ind = 0;
		int ans = 1e9;

		update(1, 0, vec_size - 1, 0, 0, 1);

		for (i = 0; i < n; i++)
		{
			while (query(1, 0, vec_size - 1, ind, ind) == 0)
				ind++;
			update(1, 0, vec_size - 1, ind, ind, -1);
			int right = v[i] / 2;
			int left = v[i] - 1 - right;

			update(1, 0, vec_size - 1, ind + 2, ind + 1 + left, 1);
			update(1, 0, vec_size - 1, ind + 2, ind + 1 + right, 1);
			int upd = tree[1] + lazy[1] * n;
			if (upd >= k)
			{
				int ne = finder(1, 0, vec_size - 1, k);
				if (ne < ans)
					ans = ne;
				// ans = min(ans, ne);
			}
		}

		if (ans == 1e9)
			ans = -1;
		cout << ans << endl;
	}
#ifdef LOCAL_ABHAY
	cout << "\nDONE\n";
	cout << time(NULL) % 100;
#endif
}