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 ll maxN=1e6+10;
ll a[maxN];
ll node[maxN*4];
ll lazy [ maxN * 4 ] ;
ll num[maxN];
void Push_down(int l,int r,int rt)
{
      if(lazy[rt]!=0)
      {
            int mid=(l+r)/2;
            node[rt*2]+=(mid-l+1)*lazy[rt];
            node[rt*2+1]+=(r-mid)*lazy[rt];
            lazy[rt*2]+=lazy[rt];
            lazy[rt*2+1]+=lazy[rt];
            lazy[rt]=0;
      }
      return ;
}
void  Push_up(int rt)
{
    node[ rt ] =node [ rt * 2 ] + node [ rt * 2 + 1 ] ;
    //node[ rt ] = max ( node[rt*2],node [rt *2+1]) ;
}

void Build(int l,int r,int rt)
{
    lazy[rt]=0;
    if(l==r)
    {
        node[rt]=num[l] ;
        return ;
    }
    int mid=(l+r)/2;
    Build(l,mid,rt*2);
    Build(mid+1,r,rt*2+1);
    Push_up(rt);
}

int Query(int L, int R, int rt,ll k)
{
    if(L==R) return L;
    Push_down(L,R,rt);
    int mid=(L+R)/2;
    if(k<=node[rt*2]) return Query(L,mid,rt*2,k);
    else return Query(mid+1,R,rt*2+1,k-node[rt*2]);
}
void Update(int l,int r ,int rt,int L,int R,ll K)
{
    if (l>=L&&r<=R)
    {
        lazy[rt]+=K;
        node[rt]+=(ll)(r-l+1)*K;
        return ;
    }
    Push_down(l,r,rt);
    int mid=(l+r)/2;
    if(L<=mid) Update(l,mid,rt*2,L,R,K);
    if(R>mid) Update(mid+1,r,rt*2+1,L,R,K);
    Push_up(rt);
}
int fir(int l,int r,int rt)
{
    if(l==r) return l;
    Push_down(l,r,rt);
    int mid=(l+r)/2;
    if(node[rt*2]) return fir(l,mid,rt*2);
    else return fir(mid+1,r,rt*2+1);
}
int main()
{
    int UP=1e6+5;
    int n;
    ll k;
    scanf("%d%lld",&n,&k);
    ll sum=1;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        sum+=a[i];
        sum-=2;
    }
    if(sum<k)
    {
        printf("-1\n");
        return 0;
    }
    if(k==1)
    {
        printf("0\n");
        return 0;
    }
    sort(a+1,a+1+n);
    for(int i=0;i<=UP;i++)
        num[i]=0;
    num[1]=1;
    Build(1,UP,1);
    ll pt=1;
    int ans=1e9;

    //printf("111\n");
    for(int i=n;i>0;i--)
    {
        pt+=a[i];
        pt-=2;
        int ros=fir(1,UP,1);
        Update(1,UP,1,ros,ros,-1);
        int sum=a[i]-1;
        Update(1,UP,1,ros+2,ros+2+sum/2-1,2ll);
        if(sum&1) Update(1,UP,1,ros+2+sum/2,ros+2+sum/2,1ll);
        if(pt>=k)
        {
            ans=min(ans,Query(1,UP,1,k));
        }
    }
    printf("%d\n",ans-1);
}
/*
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <limits>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#define lowbit(x) ( x&(-x) )
#define pi 3.141592653589793
#define e 2.718281828459045
#define INF 0x3f3f3f3f
#define HalF (l + r)>>1
#define lsn rt<<1
#define rsn rt<<1|1
#define Lson lsn, l, mid
#define Rson rsn, mid+1, r
#define QL Lson, ql, qr
#define QR Rson, ql, qr
#define myself rt, l, r
#define pii pair<int, int>
#define MP(a, b) make_pair(a, b)
using namespace std;
typedef unsigned long long ull;
typedef unsigned int uit;
typedef long long ll;
const int maxN = 8e5 + 7;
int N, K;
ll len[maxN];
ll tree[maxN << 3], lazy[maxN << 3];
void pushdown(int rt, int l, int r)
{
    if(lazy[rt])
    {
        int mid = HalF;
        tree[lsn] += lazy[rt] * (mid - l + 1);
        tree[rsn] += lazy[rt] * (r - mid);
        lazy[lsn] += lazy[rt];
        lazy[rsn] += lazy[rt];
        lazy[rt] = 0;
    }
}
void pushup(int rt) { tree[rt] = tree[lsn] + tree[rsn]; }
void update(int rt, int l, int r, int ql, int qr, ll val)
{
    if(ql <= l && qr >= r)
    {
        lazy[rt] += val;
        tree[rt] += val * (r - l + 1);
        return;
    }
    pushdown(myself);
    int mid = HalF;
    if(qr <= mid) update(QL, val);
    else if(ql > mid) update(QR, val);
    else { update(QL, val); update(QR, val); }
    pushup(rt);
}
int _Fir(int rt, int l, int r)
{
    if(l == r) return l;
    pushdown(myself);
    int mid = HalF;
    if(tree[lsn]) return _Fir(Lson);
    else return _Fir(Rson);
}
int _Ans(int rt, int l, int r, ll kth)
{
    if(l == r) return l;
    pushdown(myself);
    int mid = HalF;
    if(kth <= tree[lsn]) return _Ans(Lson, kth);
    else return _Ans(Rson, kth - tree[lsn]);
}
int main()
{
    scanf("%d%d", &N, &K);
    for(int i = 1; i <= N; i ++) scanf("%lld", &len[i]);
    sort(len + 1, len + N + 1, greater<ll>() );
    int ans = INF;
    int _UP = 8e5 + 5;
    update(1, 0, _UP, 0, 0, 1);
    for(int i = 1, pos, nex_L, nex_R, tmp; i <= N; i ++)
    {
        pos = _Fir(1, 0, _UP);
        update(1, 0, _UP, pos, pos, -1);
        nex_L = pos + 2;
        tmp = (int)len[i] - 1;
        nex_R = nex_L + tmp / 2 - 1;
        update(1, 0, _UP, nex_L, nex_R, 2);
        if(tmp & 1) update(1, 0, _UP, nex_R + 1, nex_R + 1, 1);
        if(tree[1] >= K)
        {
            ans = min(ans, _Ans(1, 0, _UP, K));
        }
    }
    if(ans < INF) printf("%d\n", ans);
    else printf("-1\n");
    return 0;
}
*/