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:
#pragma GCC optimize("O3")
#pragma G++ optimize("O3")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
//#define DEBUG
const int maxn = 2e6+10;
const int mod = 1e9+7;
const int N = 2e6;

ll n,a[maxn];
ll k;

ll sum[maxn<<2],add[maxn<<2]; //根节点下标为1
inline void push_up(int rt)  //rt代表当前节点
{
    sum[rt] = sum[rt<<1]+sum[rt<<1 | 1];   //父亲节点是子节点的和
}

inline void push_down(int rt,int m)  //m是更新的区间长度
{
    if(add[rt]){
        //将懒惰标记更新到下一层
        add[rt<<1] += add[rt];
        add[rt<<1 | 1] += add[rt];
        sum[rt<<1] += (m-(m>>1))*add[rt];
        sum[rt<<1 | 1] += (m>>1)*add[rt];
        //取消本层的懒惰标记
        add[rt] = 0;
    }
}

#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
void build(int l,int r,int rt) //建树时根节点从1开始
{
    add[rt] = 0;
    if(l == r){
        if(l == 1) sum[rt] = 1;
        else sum[rt] = 0;
        return;
    }
    int mid = (l+r)>>1;
    build(lson);
    build(rson);
    push_up(rt); //回溯的时候更新区间和
}

inline void update(int a,int b,ll c,int l,int r,int rt)
{
    if(a <= l && b >= r){
        sum[rt] += (r-l+1)*c;
        add[rt] += c;
        return;
    }
    push_down(rt,r-l+1);
    int mid = (l+r)>>1;
    if(a <= mid) update(a,b,c,lson);
    if(b > mid) update(a,b,c,rson);
    push_up(rt);
}

inline int query(ll k,int l,int r,int rt)
{
    if(l == r) return l;
    push_down(rt,r-l+1);
    int mid = (l+r)>>1;
    if(sum[rt<<1] >= k) return query(k,lson);
    else return query(k-sum[rt<<1],rson);
}

inline ll qu(int a,int b,int l,int r,int rt)
{
    if(a <= l && b >= r) return sum[rt];
    push_down(rt,r-l+1);   //你需要用到下一层的sum，必须更新这一层的lazy
    int mid = (l+r)>>1;
    ll ans = 0;
    if(a <= mid) ans += qu(a,b,lson);
    if(b > mid) ans += qu(a,b,rson);
    return ans;
}

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #ifdef DEBUG
        freopen("E:\acm\acm训练\example\ac.in","r",stdin);
        freopen("E:\acm\acm训练\example\ac.out","w",stdout);
    #endif

    cin>>n>>k;
    for(int i=0;i < n;++i) cin>>a[i];

    if(k == 1) {cout<<0; return 0;}

    sort(a,a+n,greater<int>());
    ll ans = 1,idx = 1;
    int res = 1e9;
    update(1,1,1,1,N,1);
    int flag = 1;
    for(int i=0;i < n;++i)
    {
        idx = query(1,1,N,1);
        update(idx,idx,-1,1,N,1);
        int tmp = a[i]-1;
        update(idx+2,idx+1+tmp/2,2,1,N,1);
        if(tmp%2) update(idx+2+tmp/2,idx+2+tmp/2,1,1,N,1);

        ans = ans + a[i] - 2;

        if(ans >= k) {flag = 0;res = min(res,query(k,1,N,1));}
    }
    if(flag) cout<<-1;
    else cout<<res-1;

    return 0;
}