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 int ll;
typedef unsigned long long int ull;
typedef long double ld;

#ifdef LOCAL
#define Gene template< class
#define Rics printer& operator,
Gene c> struct rge{c b, e;};
Gene c> rge<c> range(c i, c j){ return {i, j};}
struct printer{
    ~printer(){cerr<<endl;}
    Gene c >Rics(c x){ cerr<<boolalpha<<x; return *this;}
    Rics(string x){cerr<<x;return *this;}
    Gene c, class d >Rics(pair<c, d> x){ return *this,"(",x.first,", ",x.second,")";}
    Gene ... d, Gene ...> class c >Rics(c<d...> x){ return *this, range(begin(x), end(x));}
    Gene c >Rics(rge<c> x){
        *this,"["; for(auto it = x.b; it != x.e; ++it)
            *this,(it==x.b?"":", "),*it; return *this,"]";}
};
#define debug() cerr<<"LINE "<<__LINE__<<" >> ", printer()
#define dbg(x) "[",#x,": ",(x),"] "
#define tham getchar()
#endif

#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define eq(x, y) (fabs((x)-(y))<error)
#define bt(i) (1LL<<(i))

mt19937_64 rng((unsigned)chrono::system_clock::now().time_since_epoch().count());
//const ll mod = ;
//const ld error = ;
const ld PI = acosl(-1);

//const int/ll inf = ;
//const int nmax = ;
///===========================================  template  =======================================================

bool check(ll h, vector<ll> &input, ll k){
    vector<ll> level(h+2);
    level[0] = 1, level[1] = -1;
    ll cnt = 0, white = 1, best = 1;

//    debug(), dbg(input);

    for(int i = 0, cur = 0; i<h; i++){
        cnt += level[i];
//        debug(), dbg(cnt);

        for(int j = 0; j<cnt && cur < input.size(); j++, cur++){
            ll a = (input[cur]-1)/2;
            ll b = (input[cur]-1) - a;
            a = min(h-(i+2)+1, a);
            b = min(h-(i+2)+1, b);
            if(a+b-1 < 0) continue;
//            debug(), dbg(i), dbg(input[cur]), dbg(a), dbg(b);
            level[i+2] += 1; level[i+2+a] -= 1;
            level[i+2] += 1; level[i+2+b] -= 1;
            white += a + b - 1;
//            debug(), dbg(white);
            best = max(white, best);
        }
    }

    return best >= k;
}

int main(){
    FASTIO;

    int n;
    ll k;
    cin>>n>>k;
    vector<ll> input(n);
    ll sum = 1;
    for(int i = 0; i<n; i++) {
        cin>>input[i];
        sum += input[i] - 2;
    }
    if(sum < k){
        cout<<-1<<endl;
        return 0;
    }

    sort(input.begin(), input.end(), greater<ll>());

//    debug(), dbg(check(3, input, k));

//    return 0;

    ll lo = 2, hi = 5e6;

    while(lo <= hi){
        ll mid = (lo+hi)/2;
        if(check(mid, input, k)){
            hi = mid-1;
        }
        else{
            lo = mid+1;
        }
    }

    cout<<lo<<endl;



    return 0;
}