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>
#include <chrono>
using namespace std;
typedef long long ll;
int maxN = 0;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct treap{
    treap *l = NULL, *r = NULL;
    int key, pri;
    ll d = 0, sum = 0, cnt = 1, here = 0;
    treap(int k){
        key = k;
        pri = rng();
    }
} *t;
typedef treap* ptreap;
ll getSum(ptreap t){
    return (t ? t->sum : 0);
}
void upd(ptreap t){
    if(!t) return;
    t->cnt = 1 + (t->l ? t->l->cnt : 0) + (t->r ? t->r->cnt : 0);
    t->sum = (t->l ? t->l->sum : 0) + (t->r ? t->r->sum : 0) + t->cnt * t->d + t->here;
}
void push(ptreap t){
    if(!t) return;
    if(t->l)
        t->l->d += t->d, upd(t->l);
    if(t->r)
        t->r->d += t->d, upd(t->r);
    t->here += t->d;
    t->d = 0;
}
 
void split(ptreap t, ptreap& l, ptreap& r, int key){
    push(t);
    if(!t)
        l = r = NULL;
    else if(key <= t->key){
        split(t->l, l, t->l, key), r = t;
        upd(r);
    }
    else{
        split(t->r, t->r, r, key), l = t;
        upd(l);
    }
}
 
void merge(ptreap& t, ptreap l, ptreap r){
    push(l), push(r);
    if(!l || !r)
        t = (l ? l : r);
    else if(l->pri < r->pri)
        merge(r->l, l, r->l), t = r;
    else
        merge(l->r, l->r, r), t = l;
    upd(t);
}
 
int ask(int poz){
    ptreap t1,t2,t3;
    split(t, t1,t2,poz);
    split(t2, t2, t3, poz+1);
    int ans = t2->sum;
    merge(t1, t1, t2);
    merge(t, t1, t3);
    return ans;
}
 
void update(int l, int r, int val){
    while(maxN < r){
        ptreap t1 = new treap(maxN++);
        merge(t, t, t1);
    }
    ptreap t1, t2, t3;
    split(t, t1, t2, l);
    split(t2, t2, t3, r);
    t2->d += val, upd(t2);
    merge(t1, t1, t2);
    merge(t, t1, t3);
}
 
int find(ptreap t, int k){
    push(t);
    if(k <= getSum(t->l))
        return find(t->l, k);
    if(k <= t->sum - getSum(t->r))
        return t->key;
    return find(t->r, k - (t->sum - getSum(t->r)) );
}
 
int main(){
    cin.sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    vector<int> chains(n);
    for(int& a : chains)
        cin>>a;
    sort(chains.begin(), chains.end());
    reverse(chains.begin(), chains.end());
    update(0,1,1);
    ll current = 1;
    int level = 0, ans = 1e9;
    for(int i = 0; i < n; i++){
        update(level, level+1, -1);
        int start = level+2, end = start + (chains[i]-1)/2;
        update(start, end, 2);
        current += chains[i]-2;
        if(chains[i]%2 == 0)
            update(end, end+1, 1);
        while(ask(level) == 0)
            level++;
        if(k <= current)
            ans = min(ans, find(t, k));
    }
    if(current < k)
        cout<<"-1\n", exit(0);
    cout<<ans<<"\n";
 
}