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:
// Artur Kraska, II UWr

#include <bits/stdc++.h>

#define forr(i, n)                  for(int i=0; i<n; i++)
#define FOREACH(iter, coll)         for(auto iter = coll.begin(); iter != coll.end(); ++iter)
#define FOREACHR(iter, coll)        for(auto iter = coll.rbegin(); iter != coll.rend(); ++iter)
#define lbound(P,R,PRED)            ({typeof(P) X=P,RRR=(R), PPP = P; while(PPP<RRR) {X = (PPP+(RRR-PPP)/2); if(PRED) RRR = X; else PPP = X+1;} PPP;})
#define testy()                     int _tests; scanf("%d", &_tests); FOR(_test, 1, _tests)
#define CLEAR(tab)                  memset(tab, 0, sizeof(tab))
#define CONTAIN(el, coll)           (coll.find(el) != coll.end())
#define FOR(i, a, b)                for(int i=a; i<=b; i++)
#define FORD(i, a, b)               for(int i=a; i>=b; i--)
#define MP                          make_pair
#define PB                          push_back
#define ff                          first
#define ss                          second
#define deb(X)                      ;

#define M 1000000007
#define INF 1000000007LL

using namespace std;

int n, k, S = 1;
int tab[1000007];

struct drzewo
{
    long long suma;
    long long ile;
};
drzewo d[2200007];

int znajdz_ity(long long ile)
{
    deb(cout << "szuka " << ile << "-tego" << endl);
    if(d[1].suma < ile)
        return INF;
    long long nr = 1, dl = S, ilosc = 0;
    while(nr < S)
    {
        dl /= 2;
        ilosc += d[nr].ile;
        if(d[nr*2].suma + ilosc*dl >= ile)
            nr *= 2;
        else
        {
            ile -= d[nr*2].suma + ilosc * dl;
            nr = nr*2+1;
        }
    }
    deb(cout << "   znalazl " << nr-S << endl);
    return nr-S;
}

void dokladaj(int nr, int pocz, int kon, int p, int k, int ile)
{
    if(p == pocz && k == kon)
    {
        deb(cout << "doklada przedzial od " << pocz << " do " << kon << endl);
        d[nr].ile += ile;
    }
    else
    {
 ///       cout << "eee " << pocz << " " << kon << endl;
        int s = (pocz + kon)/2;
        if(k <= s)
            dokladaj(nr*2, pocz, s, p, k, ile);
        else
        {
            if(p > s)
                dokladaj(nr*2+1, s+1, kon, p, k, ile);
            else
            {
                dokladaj(nr*2,   pocz, s,   p,   s, ile);
                dokladaj(nr*2+1, s+1,  kon, s+1, k, ile);
            }
        }
    }
//    cout << "tutaj?" << endl;
    if(nr >= S)
        d[nr].suma = d[nr].ile;
    else
        d[nr].suma = d[nr].ile*(kon-pocz+1) + d[nr*2].suma + d[nr*2+1].suma;
}


int main()
{
    scanf("%d %d", &n, &k);
    forr(i, n)
        scanf("%d", &tab[i]);
    sort(tab, tab+n);

    while(S <= 500000)
        S *= 2;

    int ile = 1;
    int poz = 0;
    int res = INF;
    dokladaj(1, 0, S-1, 0, 0, 1);
    for(int i=n-1; i >= 0; i--)
    {
        deb(cout << "doklada lancuch " << tab[i] << endl);
        int poz = znajdz_ity(1);
        dokladaj(1, 0, S-1, poz, poz, -1);
        int ile1 = (tab[i])/2;
        int ile2 = (tab[i]-1)/2;
        dokladaj(1, 0, S-1, poz+2, poz+ile1+1, 1);
        dokladaj(1, 0, S-1, poz+2, poz+ile2+1, 1);
        res = min(res, znajdz_ity(k));
    }
    printf("%d\n", res == INF ? -1 : res);

    return 0;
}