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<iostream>
#include<vector>
#include<cstring>
#include<unordered_map>
#include<math.h>
#include<map>
#include<algorithm>
#include<iomanip>
#include<stdio.h>
#include<set>
#include<queue>
#include<tuple>

using namespace std;

#define ll long long
#define int long long
typedef vector<ll> vi;
typedef pair<ll, ll>  ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
#define INF 1e9
#define INF64 (ll)1e18
#define pb push_back
#define F first
#define S second
#define MP make_pair
#define forn(i,l,r) for(ll i=l ; i<r ; i++)
void print(vi& a) {for(int i : a) cout<<i<<' '; cout<<endl;}
// int n;
// vi x,y,v;
// map<int, set<int> > xs, ys;
// map<ii, int> pos;

// void choose(int x, int y) {
//     int lx = -1;
//     auto left = lower_bound(ys[y].begin(), ys[y].end(), x[i]);
//     if(left == ys[i].begin());
//     else {
//         left--;
//         lx = *left;
//     }
//     int lL = pos[]
// }
// int n;
// vi a;
ll max(ll a, ll b) {return (a>b)?a:b;}
ll min(ll a, ll b) {return (a>b)?b:a;}
void countSort(int k, vector<int>& SA, vector<int>& eqC){
    int n = SA.size();
 
    int maxi = max(300, n);
    vector<int> count(maxi,0);
    for(int i=0;i<n;i++)
        count[i+k<n ? eqC[i+k] : 0]++;
    
    vector<int> pos(maxi,0);
    pos[0]=0;
    for(int i=1;i<maxi;i++)
        pos[i] = pos[i-1] + count[i-1];
    
    vector<int> tempSA(n,0);
    for(int i=0;i<n;i++)
        tempSA[pos[SA[i]+k<n?eqC[SA[i]+k]:0]++] = SA[i];
    
    for(int i=0;i<n;i++) SA[i]=tempSA[i];
}
 
vector<int> buildSA(string& t){
    t+='$';
 
    int n=t.length();
    vector<int> SA(n,0), eqC(n,0);
 
    for(int i=0;i<n;i++) SA[i]=i;
    for(int i=0;i<n;i++) eqC[i]=t[i];
 
    for(int k=1;k<n;k<<=1){ //logn
        countSort(k, SA, eqC); // n
        countSort(0,SA,eqC); // n
        
        vector<int> tempEqC(n, 0);
        int r = tempEqC[SA[0]] = 0;
        for(int i=1;i<n;i++){ // n
            if(eqC[SA[i]] == eqC[SA[i-1]] && eqC[SA[i]+k] == eqC[SA[i-1]+k])
                tempEqC[SA[i]] = r;
            else tempEqC[SA[i]] = ++r;
        }
        for(int i=0;i<n;i++) eqC[i] = tempEqC[i];
    }
    return SA;
}
vector<int> lcp(string txt, vector<int> SA) {
    int  i, L;
    int n = txt.length();
    vector<int> Phi(SA.size(), 0);
    Phi[SA[0]]=-1;
    for(int i=1;i<n;i++)
        Phi[SA[i]] = SA[i-1];
    vector<int> PLCP(SA.size(),0);
    for(i=L=0; i<n;i++){
        if(Phi[i]==-1){PLCP[i]=0; continue;}
        while(txt[i+L] == txt[Phi[i] + L]) L++;
        PLCP[i]=L;
        L=max(L-1,0);
    }
    vector<int> LCP(SA.size());
    for(i=0;i<n;i++)
        LCP[i]=PLCP[SA[i]];
    return LCP;
}  
const int N = 400010;
int n,k;
int BIT1[N], BIT2[N];
int l[N];
void update(int ind, int x, int BIT[]) {
    while(ind < N) {
        BIT[ind] += x;
        ind += ind&-ind;
    }
}

int query(int ind, int BIT[]) {
    int sum=0;
    while(ind > 0) {
        sum += BIT[ind];
        ind -= ind&-ind;
    }
    return sum;
}

int getElement(int ind) {
    // querying on first BIT
    return query(ind, BIT1);
}

void rangeUpdate(int l, int r, int val) {
    update(l, val, BIT1);
    update(r+1, -val, BIT1);

    update(l, (l-1)*val, BIT2);
    update(r+1, -(r*val), BIT2);
}

int preSum(int x) {
    return x*query(x, BIT1) - query(x, BIT2);
}

int rangeSum(int l, int r) {
    return preSum(r) - preSum(l-1);    
}

int checkIndex(int f) {
    if(preSum(N-1) < f) return -1;
    int lo = 0, hi = N-1;
    while(lo < hi) {
        if(lo == hi - 1) {
            if(preSum(lo)>=f) return lo;
            return hi;
        } 
        int mid = (lo+hi) / 2;
        if(preSum(mid) < f) lo = mid;
        else hi = mid;
    }
    return hi;
}

int32_t main() {
    // update(0, 0, BIT1);
    // cout<<BIT1[0]<<endl;
    // rangeUpdate(1, 5, 1);
    // rangeUpdate(3, 5, 2);
    // cout<<preSum(6);
    // cout<<checkIndex(5);
    cin>>n>>k;
    for(int i=0;i<n;i++) {
        cin>>l[i];
    }
    sort(l, l+n, greater<int>());
    int first = 1;
    rangeUpdate(1, 1, 1);
    int Min = 1e18;
    for(int i=0;i<n;i++) {
        while(!preSum(first)) first++;
        rangeUpdate(first, first, -1);
        int l1 = l[i] / 2;
        int l2 = l[i] - 1 - l1;
        rangeUpdate(first+2, first+2+l1-1, 1);
        rangeUpdate(first+2, first+2+l2-1, 1);
        int sub = checkIndex(k); 
        if(sub!=-1) Min=min(Min, sub);
        // Min = min(Min, checkIndex(k));
    }
    if(Min == 1e18) cout<<-1<<endl;
    else cout<<Min-1<<endl;
    // sort(l)
    return 0;
}