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;

//define
#define trav(i,v)   for(auto i: v)
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define all(v)  v.begin(), v.end()
#define itn int 
    
//typedef
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const long long MOD = 1000000007;
// const long long MOD = 998244353;
const long long inf = 1000000000000000000;
const long long small_inf = 100000000000000;
 
ll modpow(ll x, ll n, ll mod = MOD){ ll res=1; while(n>0){ if(n&1) res=res*x%mod; x=x*x%MOD; n>>=1;} return res;}
ll power(ll x, ll n){ ll res=1; while(n>0){ if(n&1) res=res*x; x=x*x; n>>=1; } return res;}

void init()
{
    
}

struct seg{
    int n;
    vll lazy, v;
    seg(int n) : n(n)
    {
        lazy.resize(4*n+5), v.resize(4*n+5);
        fill(all(v),0);
        fill(all(lazy),0);
    }
    void prop(int x, int l, int r)
    {
        v[x]+=(r-l+1ll)*lazy[x];
        lazy[2*x]   += lazy[x];
        lazy[2*x+1] += lazy[x];
        lazy[x] = 0;
    }
    void update(int l1, int r1, ll ch, int l, int r, int x)
    {
        if(r<l1 || l>r1)
        {
            prop(x,l,r);
            return;
        }
        if(l>=l1 && r<=r1)
        {
            lazy[x] += ch;
            if(l==r)
            {
                v[x]+=lazy[x];
                lazy[x] = 0;
            }
            else
            {
                prop(x,l,r);
            }
            return;
        }
        int m = (l+r)/2;
        prop(x,l,r);
        update(l1,r1,ch,l,m,2*x);
        update(l1,r1,ch,m+1,r,2*x+1);
        v[x] = v[2*x]+v[2*x+1];
        return;
    }
    void update(int l, int r, ll ch)
    {
        r = min(r,n);
        update(l,r,ch,0,n,1);
        return;
    }
    ll get(int pos, int l, int r, int x)
    {
        if(pos<l || pos>r)
            return 0;
        if(pos==l && r==l)
        {
            v[x]+=lazy[x];
            lazy[x] = 0;
            return v[x];
        }
        prop(x,l,r);
        int m = (l+r)/2;
        return get(pos,l,m,2*x)+get(pos,m+1,r,2*x+1);
    }
    ll get(int x)
    {
        return get(x,0,n,1);
    }
    ll query(int k, int l, int r, int x)
    {
        if(l==r)
        {
            v[x]+=lazy[x];
            lazy[x] = 0;
        }
        else
        {
            prop(x,l,r);
        }
        if(v[x]<k)
            return -1;
        if(l==r)
            return l;
        int m = (l+r)/2;
        int res = query(k,l,m,2*x);
        if(res==-1)
        {
            res = query(k-v[2*x],m+1,r,2*x+1);
        }
        return res;
    }
    ll query(int k)
    {
        return query(k,0,n,1);
    }
};

bool custom_sort(ll x, ll y)
{
    if(y<x)
        return 1;
    return 0;
}

void solve()
{
    int n;
    ll k, k1 = 1;
    cin>>n>>k;
    vll l(n,0);
    int N = 400001;
    rep(i,n)
        cin>>l[i];
    sort(all(l),custom_sort);
    int x = 0;
    vll v(N,0);
    v[0] = 1;
    seg s = seg(N);
    ll mn = inf;
    ll xx = 0;
    rep(i,n)
    {
        // cout<<l[i]<<" ";
        xx+=l[i];
    }
    cout<<endl;
    s.update(0,0,1);
    rep(i,n)
    {
        if(l[i]<=2)
            break;
        ll cnt;
        while(!(cnt = s.get(x)))
            x++;
        s.update(x,x,-1);
        k1--;
        s.update(x+2,x+1+(l[i]-1)/2,2);
        // cout<<s.n<<" "<<x+1+(l[i]-1)/2<<" "<<((x+1+(l[i]-1)/2)-x-2)*2<<" "<<s.v[1]<<endl;
        if(l[i]%2==0)
            s.update(x+2+(l[i]-1)/2,x+2+(l[i]-1)/2,1);
        k1+=l[i]-1;
        if(k1>=k)
        {
            mn = min(mn, s.query(k));
        }
    }
    // cout<<s.v[1]<<endl;
    if(mn == inf)
        mn = -1;
    cout<<mn<<endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t23 = 1, tt23=1;
    // cin>>t23;    
    init();
    while(tt23<=t23)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
        tt23++;
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}