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>

#define dd(x) cout<<#x<<" = "<<x<<" " 
#define de(x) cout<<#x<<" = "<<x<<"\n" 
#define mem(p, w) memset(p, w, sizeof(p))
#define all(x) x.begin(), x.end()
#define ll long long
#define mp make_pair
#define se second
#define fi first

using namespace std;

const int MAXN = 400000 + 10;
const int INF = 1e9;
int N, K;
int A[MAXN];

struct segtree {
    int n;
    ll sum[MAXN << 2], add[MAXN << 2];
    void pu(int o, int l, int r) {
        sum[o] = sum[o << 1] + sum[o << 1 | 1];
        return;
    }
    void pd(int o, int l, int r) {
        int mid = l + r >> 1;
        if(add[o] != 0) {
            add[o << 1] += add[o];
            add[o << 1 | 1] += add[o];
            sum[o << 1] += add[o] * (mid - l + 1);
            sum[o << 1 | 1] += add[o] * (r - mid);
            add[o] = 0;
        }
        return;
    }

    int _l, _r, _k; ll _w;
    void _mdf(int o, int l, int r) {
        if(l > r || _l > r || l > _r)
            return;
        if(_l <= l && r <= _r) {
            sum[o] += _w * (r - l + 1);
            add[o] += _w;
            return;
        }
        int mid = l + r >> 1;
        pd(o, l, r);
        if(_l <= mid) _mdf(o << 1, l, mid);
        if(mid < _r) _mdf(o << 1 | 1, mid + 1, r);
        pu(o, l, r);
        return;
    }
    void mdf(int l, int r, ll w) {
        //dd(l); dd(r); de(w);
        if(l > r) return;
        _l = l; _r = r; _w = w;
        _mdf(1, 1, n);
        return;
    }

    ll _getsum(int o, int l, int r) {
        ll ret = 0;
        if(l > r || _l > r || l > _r)
            return 0;
        if(_l <= l && r <= _r)
            return sum[o];
        int mid = l + r >> 1;
        pd(o, l, r);
        if(_l <= mid) ret += _getsum(o << 1, l, mid);
        if(mid < _r) ret += _getsum(o << 1 | 1, mid + 1, r);
        return ret;
    }
    ll getsum(int x) {
        ll ret = 0;
        _l = 1; _r = x;
        ret = _getsum(1, 1, n);
        return ret;
    }

    int _qry(int o, int l, int r) {
        //dd(l); dd(r); de(sum[o]);
        int ret = INF;
        if(l > r || sum[o] < _k) return INF;
        if(l == r) return l;
        int mid = l + r >> 1;
        pd(o, l, r);
        if(sum[o << 1] >= _k) ret = _qry(o << 1, l, mid);
        else {
            _k -= sum[o << 1];
            ret = _qry(o << 1 | 1, mid + 1, r);
        }
        return ret;
    }
    int qry(int k) {
        int ret = 0;
        _k = k;
        ret = _qry(1, 1, n);
        return ret;
    }

    void _debug(int o, int l, int r) {
        if(l == r) {
            printf("%lld, ", sum[o]);
            return;
        }
        int mid = l + r >> 1;
        pd(o, l, r);
        _debug(o << 1, l, mid);
        _debug(o << 1 | 1, mid + 1, r);
        return;
    } 
    void debug(){
        _debug(1, 1, n); puts("");
        return;
    }
};

segtree S;

int main() {
    scanf("%d%d", &N, &K);
    for(int i = 1; i <= N; ++i)
        scanf("%d", &A[i]);
    sort(A + 1, A + N + 1, greater<int>() );

    S.n = 400000;
    
    S.mdf(1, 1, 1);

    int ans = INF, dep = 1;
    for(int i = 1; i <= N; ++i) {
        while(S.getsum(dep) == 0)
            ++dep;
        if(dep + 2 > ans) break;
        S.mdf(dep, dep, -1);
        S.mdf(dep + 2, dep + A[i] / 2 + 1, 1);
        S.mdf(dep + 2, dep + (A[i] + 1) / 2, 1);
        
        //S.debug();
        if(S.qry(K) == INF) continue;
        ans = min(ans, S.qry(K));
        //de(ans);
    }
    printf("%d\n", ans == INF ? -1 : ans - 1);
    return 0;
}