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>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define N 500010
#define NN 1000100
#define PB push_back
#define PF push_front
#define sz(x) int(x.size())
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define _ << " " <<
#define endl '\n'
#define M ll(998244353)
#define pri(x) cout << x << endl

//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef array <int, 3> a3;
//typedef tree <int, null_type, less_equal <int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int n, k;

int a[N], t[N * 4], psh[N * 4], skok[N];

void comp(int v)
{
    if (t[v + v] == -1) t[v] = t[v + v + 1];
     else t[v] = t[v + v];
}

void Push(int v, int tl, int tr)
{
    if (psh[v] == 0) return;

    t[v] = tl;

    if (tl == tr)
    {
        t[v] = tl;

        skok[tl] += psh[v];
    }
      else
      {
          int md = (tl + tr) >> 1;

          t[v + v] = tl;

          psh[v + v] += psh[v];

          t[v + v + 1] = md + 1;

          psh[v + v + 1] += psh[v];
      }

    psh[v] = 0;
}

void updr(int v, int tl, int tr, int ps)
{
    Push(v, tl, tr);

    if (tl == tr)
    {
        skok[tl]--;

        if (skok[tl] == 0) t[v] = -1;

        return;
    }

    int md = (tl + tr) >> 1;

    if (ps <= md)
        updr(v + v, tl, md, ps);
           else updr(v + v + 1, md + 1, tr, ps);

    comp(v);
}

void upd(int v, int tl, int tr, int l, int r)
{
    Push(v, tl, tr);

    if (tr < l || r < tl || l > r || tl > tr) return;

    if (l <= tl && tr <= r) {psh[v]++; Push(v, tl, tr); return;}

    int md = (tl + tr) >> 1;

    upd(v + v, tl, md, l, r);

    upd(v + v + 1, md + 1, tr, l, r);

    comp(v);
}

bool can(int x)
{
    for (int i = 0; i < N * 4; i++) {t[i] = -1; psh[i] = 0;}

    for (int i = 0; i < N; i++) skok[i] = 0;

    upd(1, 0, N - 1, 0, 0);

    int num = 1, j = 0;

    while (j < n && num < k && num > 0)
    {
        int val = a[j];

        int ps = t[1];

        updr(1, 0, N - 1, ps);

        int L = val / 2, R = (val - 1) / 2;

        num += min(L, x - ps - 1) + min(R, x - ps - 1);

        num--;

        upd(1, 0, N - 1, ps + 2, min(x, ps + L + 1));

        upd(1, 0, N - 1, ps + 2, min(x, ps + R + 1));

        j++;
    }

    return num >= k;
}

int main()
{
	iostream::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("queries.in", "r", stdin); freopen("queries.out", "w", stdout);

    cin >> n >> k;

    ll sum = 0;

    for (int i = 0; i < n; i++) {cin >> a[i]; sum += a[i];}

    sum -= n + n - 1;

    if (k > sum) {pri(-1); exit(0);}

    sort(a, a + n);

    reverse(a, a + n);

    int l = 0, r = N - 1;

    while (l < r)
    {
        int md = (l + r) >> 1;

        if (can(md)) r = md;
          else l = md + 1;
    }

    pri(l);
}