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 ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define fillarray(array, value, begin, end) fill((array) + (begin), (array) + (end) + 1, value)
#define fillvector(v, value) fill((v).begin(), (v).end(), value)
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
#define vecfirst (*vec.begin())
#define veclast (*vec.rbegin())
#define vecall(v) (v).begin(), (v).end()
#define vecupsort(v) (sort((v).begin(), (v).end()))
#define vecdownsort(v, type) (sort(vecall(v), greater<type>()))
#define veccmpsort(v, cmp) (sort(vecall(v), cmp))
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
clock_t TIME__START, TIME__END;
void program_end()
{
#ifdef ONLINE
    printf("\n\nTime used: %.6lf(s)\n", ((double)TIME__END - TIME__START) / 1000);
    system("pause");
#endif
}
int n, k;
int a[N];
struct segtree
{
    int l, r;
    ll sum, lazy;
} t[N << 2];
inline void pushup(int id) { t[id].sum = t[ls].sum + t[rs].sum; }
inline void pushdown(int id)
{
    if (t[id].lazy)
    {
        t[ls].sum += t[id].lazy * (t[ls].r - t[ls].l + 1);
        t[rs].sum += t[id].lazy * (t[rs].r - t[rs].l + 1);
        t[ls].lazy += t[id].lazy, t[rs].lazy += t[id].lazy;
        t[id].lazy = 0;
    }
}
void build(int l, int r, int id)
{
    t[id].l = l, t[id].r = r;
    t[id].lazy = 0;
    if (l == r)
        return;
    int mid = (l + r) >> 1;
    build(l, mid, ls);
    build(mid + 1, r, rs);
}
void change(int L, int R, ll val, int id)
{
    int l = t[id].l, r = t[id].r;
    if (L <= l && R >= r)
    {
        t[id].sum += (r - l + 1ll) * val;
        t[id].lazy += val;
        return;
    }
    pushdown(id);
    int mid = (l + r) >> 1;
    if (R <= mid)
        change(L, R, val, ls);
    else if (L > mid)
        change(L, R, val, rs);
    else
    {
        change(L, mid, val, ls);
        change(mid + 1, R, val, rs);
    }
    pushup(id);
}
ll querysum(int L, int R, int id)
{
    int l = t[id].l, r = t[id].r;
    if (L <= l && R >= r)
        return t[id].sum;
    pushdown(id);
    int mid = (l + r) >> 1;
    if (R <= mid)
        return querysum(L, R, ls);
    else if (L > mid)
        return querysum(L, R, rs);
    else
        return querysum(L, mid, ls) + querysum(mid + 1, R, rs);
}

inline void solve()
{
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; ++i)
        scanf("%d", &a[i]);
    sort(a + 1, a + n + 1, greater<int>());
    build(1, 500000, 1);
    change(1, 1, 1, 1);
    int nowleft = 1, nowdep = 1, ans = inf;
    for (int i = 1; i <= n; ++i)
    {
        int adep = (a[i] - 1) / 2;
        change(nowdep, nowdep, -1, 1);
        change(nowdep + 2, nowdep + adep + 1, 2, 1);
        if (a[i] % 2 == 0)
            change(nowdep + adep + 2, nowdep + adep + 2, 1, 1);
        nowleft--;
        while (nowleft == 0)
            nowdep++, nowleft = querysum(nowdep, nowdep, 1);
        if (querysum(1, 500000, 1) < k)
            continue;
        int l = nowdep, r = 500000, res = inf;
        while (l <= r)
        {
            int mid = (l + r) >> 1;
            if (querysum(1, mid, 1) >= k)
                res = mid, r = mid - 1;
            else
                l = mid + 1;
        }
        ans = min(ans, res);
    }
    if (ans == inf)
        ans = 0;
    printf("%d\n", ans - 1);
}

int main()
{
    TIME__START = clock();
    int Test = 1;
    // scanf("%d", &Test);
    while (Test--)
    {
        solve();
        // if (Test)
        //     putchar('\n');
    }
    TIME__END = clock();
    program_end();
    return 0;
}