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:
// Author : heyuhhh
// Created Time : 2020/12/29 18:59:47
#include<bits/stdc++.h>
#define MP make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 2e5 + 5, MAX_DEEP = 2e6 + 5;

int n, k;
int a[N];

ll sumv[MAX_DEEP + 1 << 2], lz[MAX_DEEP + 1 << 2];
void tag(int o, int l, int r, ll v) {
    sumv[o] += 1ll * (r - l + 1) * v;
    if (lz[o] == INF) lz[o] = v;
    else lz[o] += v;
}

void push_up(int o) {
    sumv[o] = sumv[o << 1] + sumv[o << 1|1];
}

void push_down(int o, int l, int r) {
    if(lz[o] != INF) {
        int mid = (l + r) >> 1;
        tag(o << 1, l, mid, lz[o]);
        tag(o << 1|1, mid + 1, r, lz[o]);
        lz[o] = INF;   
    }
}

void build(int o, int l, int r) {
    lz[o] = INF;
    if(l == r) {
        if (l == 1) sumv[o] = 1;
        else sumv[o] = 0;
        return;
    }
    int mid = (l + r) >> 1;
    build(o << 1, l, mid), build(o << 1|1, mid + 1, r);
    push_up(o);
}

void update(int o, int l, int r, int L, int R, ll v) {
    if(L <= l && r <= R) {
        tag(o, l, r, v);
        return;
    }   
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    if(L <= mid) update(o << 1, l, mid, L, R, v);
    if(R > mid) update(o << 1|1, mid + 1, r, L, R, v);
    push_up(o);
}

ll query(int o, int l, int r, int L, int R) {
    if(L <= l && r <= R) {
        return sumv[o];
    }
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    ll res = 0;
    if(L <= mid) res += query(o << 1, l, mid, L, R);
    if(R > mid) res += query(o << 1|1, mid + 1, r, L, R);
    return res;
}

int find_dep(int o, int l, int r) {
    if (l == r) {
        return l;
    }
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    if (sumv[o << 1] > 0) return find_dep(o << 1, l, mid);
    return find_dep(o << 1|1, mid + 1, r);
}

int queryAns(int o, int l, int r, int K) {
    if (l == r) {
        return l;
    }
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    if (sumv[o << 1] >= K) return queryAns(o << 1, l, mid, K);
    return queryAns(o << 1|1, mid + 1, r, K - sumv[o << 1]);
}

void run() {
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    reverse(a + 1, a + n + 1);
    ll tot = 1;
    bool flag = false;
    for (int i = 1; i <= n; i++) {
        tot += a[i] - 2;
        if (tot >= k) {
            flag = true;
            break;
        }
    }
    if (!flag) {
        cout << -1 << '\n';
        return;
    }
    int ans = INF;
    build(1, 1, MAX_DEEP);
    for (int i = 1; i <= n; i++) {
        int last = find_dep(1, 1, MAX_DEEP);
        update(1, 1, MAX_DEEP, last, last, -1);
        if (a[i] & 1) {
            int l = last + 2, r = last + 1 + a[i] / 2;
            update(1, 1, MAX_DEEP, l, r, 2);
        } else {
            int l = last + 2, r = last + a[i] / 2;
            update(1, 1, MAX_DEEP, l, r, 2);
            ++r;
            update(1, 1, MAX_DEEP, r, r, 1);
        }
        if (sumv[1] >= k) {
            int res = queryAns(1, 1, MAX_DEEP, k) - 1;
            ans = min(ans, res);
        }
    }
    cout << ans << '\n';
}
int main() {
#ifdef Local
    freopen("input.in", "r", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    run();
    return 0;
}