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 = 200010;
int n,k;
int l[N], diff[2*N + 10];
int32_t main() {
    cin>>n>>k;
    for(int i=0;i<n;i++) {
        cin>>l[i];
    }
    sort(l, l+n, greater<int>());
    diff[0] = 1; diff[1] = -1;
    int j=0;
    int sum1=0, sum=0;
    int ans = -1;
    for(int i=0;i<N-1;i++) {
        sum1 += diff[i];
        sum += sum1;
        if(sum >= k) {
            ans = i;
            break;
        }
        if(sum + sum1 + diff[i+1] >= k) {
            ans = i+1;
            break;
        }
        int osum=sum1;
        while(sum1 && j < n) {
            diff[i]--; diff[i+1]++;
            int l1=l[j]/2;
            int l2 = l[j] - l1 - 1;
            diff[i+2]++; diff[i+2+l1]--;
            diff[i+2]++; diff[i+2+l2]--;
            j++;
            sum1--;
        }
        sum -= (osum - sum1);
    }
    cout<<ans<<endl;
    return 0;
}