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 ll;

const int INFi = 1e9+67;
const ll INFll = 1e18;

using NumberType = double;

namespace {

}

namespace std {
    template<typename a, typename b>
    struct hash<std::pair<a, b> > {
    public:
        hash() {}
        size_t operator()(const std::pair<a, b> &p) const {
            return hash<a>()(p.first) + hash<b>()(p.second)*998242353;
        }
    };
};

ll mod = 1e9+7;
//ll mod = 998244353;

using ld = double;

double eps = 1e-9;

const int maxn = 1e6+5;
//const int maxn2 = maxn*maxn;

//double dp[10][maxn][maxn*maxn];

namespace {
    template <typename T_, typename PushT_>
    struct RMQ {
        using T = T_;
        using PushT = PushT_;
        vector<T> mas;
        T neutral;
        int size;
        std::function<T(const T&,const T&)> op;

        vector<PushT> masPush;
        PushT neutralPush;
        std::function<pair<PushT, PushT>(const PushT&)> opPush; //calc what to push to children
        std::function<void(PushT&, T&, int)> opApply; //apply change in vertex
        std::function<PushT(const PushT&, const PushT&)> opPendingCompose; //compose two pending ops

        RMQ(int size, std::function<T(const T&,const T&)> op, T neutral,
            std::function<pair<PushT, PushT>(const PushT&)> opPush, PushT neutralPush,
            std::function<void(PushT&, T&, int)> opApply,
            std::function<PushT(const PushT&, const PushT&)> opPendingCompose) {
            this->neutral = neutral;

            int deg2 = 1;
            while (deg2<size) {
                deg2<<=1;
            }
            this->size = deg2;

            this->op = op;
            mas.assign(2*this->size, neutral);
            this->opPush = opPush;
            this->opApply = opApply;
            this->opPendingCompose = opPendingCompose;
            this->neutralPush = neutralPush;
            masPush.assign(2*this->size, neutralPush);
        }

        void setVal(int pos, T val) {
            assert(pos>=0 && pos<size);
            setValImpl(pos, val, 0, size-1,1);
        }

        T getVal(int pos) {
            return query(pos, pos);
        }

        void setValImpl(int pos, T val, int l, int r, int v) {
            push(v, l==r, r-l+1); //i think it should, need to check
            if (l==r && r==pos) {
                mas[v] = val;
                return;
            }
            if (l>pos || r< pos) return;
            int m = (l+r)/2;
            setValImpl(pos, val, l, m, 2*v);
            setValImpl(pos, val, m+1, r, 2*v+1);
            mas[v] = op(mas[2*v], mas[2*v+1]);
        }

        void modify(int l, int r, PushT d) {
            assert(l>=0 && l<=r && r<size);
            modifyImpl(l, r, d, 0, size-1, 1);
        }

        void push(int v, bool isLeaf, int segLen) {
            if (!isLeaf) {
                auto p = opPush(masPush[v]);
                masPush[2*v] = opPendingCompose(masPush[2*v], p.first);
                masPush[2*v+1] = opPendingCompose(masPush[2*v+1], p.second);
            }
            opApply(masPush[v], mas[v], segLen);
        }

        void modifyImpl(int rq_l, int rq_r, ll d, int l, int r, int v){
            push(v, l==r, r-l+1);
            if (rq_l>r || l>rq_r) return;
            if (rq_l<=l && r<=rq_r) {
                masPush[v] = opPendingCompose(masPush[v], d);
                push(v, l==r, r-l+1);
                return;
            }
            int m = (l+r)/2;
            modifyImpl(rq_l, rq_r, d, l, m, 2*v);
            modifyImpl(rq_l, rq_r, d, m+1, r, 2*v+1);
            mas[v] = op(mas[2*v], mas[2*v+1]);
        }

        T query(int l, int r) {
            assert(l>=0 && l<=r && r<size);
            return queryImpl(l, r, 0, size-1, 1);
        }

        T queryImpl(int rq_l, int rq_r, int l, int r, int v) {
            push(v, l==r, r-l+1);

            if (rq_l>r || l>rq_r) return neutral;
            if (rq_l<=l && r<=rq_r) {
                return mas[v];
            }
            int m = (l+r)/2;
            T ans1 = queryImpl(rq_l, rq_r, l, m, 2*v);
            T ans2 = queryImpl(rq_l, rq_r, m+1, r, 2*v+1);
            return op(ans1, ans2);
        }

        ll findFirstGreaterEq(T val) {
            return findFirstGreaterEqImpl(val, 0, size-1, 1);
        }

        int findFirstGreaterEqImpl(T val, int l, int r, int v) {
            push(v, l==r, r-l+1);

            if (mas[v]<val) {
                return -1;
            }
            if (l==r) {
                return l;
            }

            int m = (l+r)/2;
            int res = findFirstGreaterEqImpl(val, l, m, 2*v);
            if (res==-1) {
                res = findFirstGreaterEqImpl(val-mas[2*v], m+1, r, 2*v+1);
            }
            return res;
        }
    };

}

void solve() {
    int n,k;
    cin >> n >> k;
    vector<ll> len(n);
    for (int i=0;i<n;i++) {
        cin >> len[i];
    }
    sort(len.rbegin(), len.rend());
    RMQ<ll,ll> rmq(maxn, [] (const ll& a, const ll&b) {return a+b;}, 0,
                      [] (const ll& a) {return pair<ll,ll>(a,a);}, 0,
                      [] (ll& pushed, ll& val, int seglen) {val+=pushed*seglen; pushed = 0;},
                      [] (const ll& app1, const ll& app2) {return app1+app2;});

    rmq.setVal(0,1);
    ll ans = INFll;
    for (int i=0;i<n;i++) {
        int firstWhite = rmq.findFirstGreaterEq(1);

        rmq.setVal(firstWhite, rmq.getVal(firstWhite)-1);
        int lenL = (len[i]-1)/2;
        int lenR = len[i]-1 - lenL;
        rmq.modify(firstWhite+2, min(maxn-1ll, firstWhite+2+lenL-1ll), 1);
        rmq.modify(firstWhite+2, min(maxn-1ll, firstWhite+2+lenR-1ll), 1);

        int newHeight = rmq.findFirstGreaterEq(k);

        if (newHeight==-1) continue;
        ans = min(ans, (ll)newHeight);
    }
    if (ans == INFll) ans = -1;
    cout << ans;
}

int main() {
//        freopen("input.txt","w",stdout);
//        int n = 100'000;
//        cout << n << " " << 1'000'000'000 << endl;
//        for (int i=0;i<n;i++) {
//            cout << 200'000 << " ";
//        }
    //    cout << 10 << " " << 0 << "\n";
    //    int starsLeft = 5;
    //    for (int i=0;i<10;i++) {
    //        for (int j=0;j<10;j++) {
    //            int kekw = rand() % 20;
    //            if (kekw==1 && starsLeft) {
    //                cout << "*";
    //                starsLeft--;
    //            } else {
    //                cout << ((char) ('0' + (rand() % 10)));
    //            }
    //        }
    //        cout << "\n";
    //    }
//        return 0;
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // freopen("input.txt","r",stdin);
    //freopen("output.bin","w",stdout);
    //freopen("/tmp/output.txt","w",stdout);
    cout << setprecision(15) << fixed;
//    int t;
//    cin >> t;
//    for (int i=0;i<t;i++)
        //    ll start = clock();
        //    while (1)
        solve();
    //    double time = (clock() - start) * 1.0 / CLOCKS_PER_SEC;
    //    cout<< time << "s.";
    return 0;
}