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 db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbd(a) cout << #a << ": " << a << endl
#define dbd2(a,b) cout << #a << ": " << a << ", " << #b << ": " << b << endl 
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto _i:a) cout << _i << " "; cout << endl
#define adbp(a) for(auto _i:a) cout << _i.first << " " << _i.second << endl;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 1000000007
#define N 300010
#define M 100010
using namespace std;

long long tree[4*N], lazy[4*N];

void update(int node, int l, int r, int i, int j, long long val)
{
    if(lazy[node])
    {
        tree[node] += lazy[node] * (r - l + 1);

        if(l != r)
        {
            int lc = 2*node, rc = 2*node + 1;
            lazy[lc] += lazy[node];
            lazy[rc] += lazy[node];
        }

        lazy[node] = 0;
    }

    if(l > j || r < i) return;

    if(l >= i && r <= j)
    {
        tree[node] += val * (r - l + 1);

        if(l != r)
        {
            int lc = 2*node, rc = 2*node + 1;
            lazy[lc] += val;
            lazy[rc] += val;
        }
        return;
    } 

    int lc = 2*node, rc = 2*node + 1, m = (l + r)/2;

    update(lc, l, m, i, j, val);
    update(rc, m+1, r, i, j, val);

    tree[node] = tree[lc] + tree[rc];
}

long long query(int node, int l, int r, int i, int j)
{
    if(lazy[node])
    {
        tree[node] += lazy[node] * (r - l + 1);

        if(l != r)
        {
            int lc = 2*node, rc = 2*node + 1;
            lazy[lc] += lazy[node];
            lazy[rc] += lazy[node];
        }

        lazy[node] = 0;
    }

    if(l > j || r < i) return 0;

    if(l >= i && r <= j) return tree[node];

    int lc = 2*node, rc = 2*node + 1, m = (l + r)/2;

    return query(lc, l, m, i, j) + query(rc, m+1, r, i, j);
}

int binsearch(int k)
{
    int low = 0, high = N, ans = INT_MAX;

    while(low <= high)
    {
        int mid = (low + high)/2;

        if(query(1, 0, N-1, 0, mid) >= k) ans = mid, high = mid - 1;
        else low = mid + 1;
    }

    return ans;
}

int main()
{
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif

    fastIO;
    long long n, k;
    cin >> n >> k;

    long long l[n];
    for(int i=0; i<n; i++) cin >> l[i], l[i]--;

    sort(l, l+n, greater<long long>());

    multiset<pair<long long, long long>> st;
    st.insert({0, 0});
    update(1, 0, N-1, 0, 0, 1);

    int ans = INT_MAX;

    for(int i=0; i<n; i++)
    {
        pair<long long, long long> p = *(st.begin());
        st.erase(st.begin());

        int u = p.first + 2, d1 = p.first + 1 + l[i]/2, d2 = d1 + l[i]%2;

        st.insert({u, d1});
        update(1, 0, N-1, u, d1, 1);
        st.insert({u, d2});
        update(1, 0, N-1, u, d2, 1);

        if(p.first + 1 <= p.second) st.insert({p.first + 1, p.second});
        update(1, 0, N-1, p.first, p.first, -1);

        ans = min(ans, binsearch(k));
    }

    if(ans == INT_MAX) ans = -1;

    cout << ans << endl;
}