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 int long long int
#define ll long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define rep(i, init, n) for (int i = init; i < (int)n; i++)
#define rev(i, n, init) for (int i = (int)n; i >= init; i--)
#define MOD1 1e9 + 7
#define MOD2 998244353
#define f first
#define s second
#define endl '\n'
#define pii pair<int, int>
#define tii tuple<int, int>
#define all(v) v.begin(), v.end()
#define mt make_tuple
#define precise(i) cout << fixed << setprecision(i)
#define codejam cout << "Case #" << ii + 1 << ": ";
#define impossible cout << "IMPOSSIBLE" << endl;
#define error(s) throw runtime_error(s)
#define hash hash1
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
int myRand(int R)
{
     int val = rng() % R;
     assert(val >= 0);
     return val;
}

const long double PI = atan(1.0) * 4;
const int32_t INF32 = 2e9 + 7;
const int64_t INF64 = 3e18;
const int32_t LOG = 21;
int32_t MOD = MOD1;

using namespace std;

//-------------------DEBUGGING-------------------------
void my_debugger(string s, int LINE_NUM) { cerr << endl; }
template <typename start, typename... end>
void my_debugger(string s, int LINE_NUM, start x, end... y)
{
     if (s.back() != ',')
     {
          s += ',';
          cerr << "LINE(" << LINE_NUM << "): ";
     }
     int i = s.find(',');
     cerr << s.substr(0, i) << " = " << x;
     s = s.substr(i + 1);
     if (!s.empty())
          cerr << ", ";
     my_debugger(s, LINE_NUM, y...);
}

#ifdef AJIT
#define debug(...) my_debugger(#__VA_ARGS__, __LINE__, __VA_ARGS__);
#else
#define debug(...) ;
#endif

//-----------------------------------------------------

struct segtree
{
     vector<int> t;
     vector<int> lazy;
     vector<int> a;
     int n;
     
     void build(int i,int l,int r)
     {
            int mid=(l+r)>>1;
            if(l==r)
            {
                 t[i]=a[l];
                 return;
            }
            build(2*i,l,mid);
            build(2*i+1,mid+1,r);
            t[i]=t[2*i]+t[2*i+1];
     }

     segtree(int n): t(4*n+4), lazy(4*n+4)
     {
          this->n = n;
     }

     segtree(int n,vector<int>& v): t(4*n+4),lazy(4*n+4), a(v)
     {
         this->n=n;
         build(1,1,n);
     }
 
     void push(int i,int tl,int tr)
     {
           t[i]+=(tr-tl+1)*lazy[i];
           if(tl==tr)
           {
                lazy[i]=0;
                return;
           }
           lazy[2*i+1]+=lazy[i];
           lazy[2*i]+=lazy[i];
           lazy[i]=0;
     }
 
     void update1(int i,int tl,int tr,int l,int r,int inc)
     {
          push(i,tl,tr);
          if(l>r)return;
          if(l<=tl && tr<=r)
          {
               lazy[i]+=inc;
               push(i,tl,tr);
               return;
          }
          
          int tmid=(tl+tr)>>1;
          update1(2*i,tl,tmid,l,min(tmid,r),inc);
          update1(2*i+1,tmid+1,tr,max(l,tmid+1),r,inc);
          t[i]=t[2*i]+t[2*i+1]; 
     }
 
     void update(int l,int r,int inc)
     {
          update1(1,1,n,l,r,inc);
     }
 
     int query1(int i,int tl,int tr,int l,int r)
     {
          push(i,tl,tr);
          if(l>r)return 0;
          if(l<=tl && tr<=r)
          return t[i];
          int tmid=(tl+tr)>>1;
          return query1(2*i,tl,tmid,l,min(tmid,r))+query1(2*i+1,tmid+1,tr,max(l,tmid+1),r);
     }  
 
     int query(int l,int r)
     {
          return query1(1,1,n,l,r);
     }

     int bound1(int i,int tl,int tr,int lim)
     {
          push(i,tl,tr);
          if(t[i]<lim)return -1;
          if(tl==tr)return tr;
          int tmid=(tl+tr)>>1;
          push(2*i,tl,tmid);
          if(t[2*i]>=lim)return bound1(2*i,tl,tmid,lim);
          return bound1(2*i+1,tmid+1,tr,lim-t[2*i]);  
     }

     int bound(int lim)
     {
          return bound1(1,1,n,lim); 
     }
};

int32_t main()
{
     getFaster;
     //files_init();
     int tests = 1;
     //cin >> tests;
     rep(ii, 0, tests)
     {
           int n,k;
           cin>>n>>k;
           vector<int> a(n);
           rep(i,0,n)cin>>a[i];
           sort(a.rbegin(),a.rend());
           int BIG=200001;
           segtree seg(3*BIG+5);
           int ptr=0;
           int ans=-1;
           rep(i,0,3*n+1)
           {
                debug(i);
                if(ptr==a.size())break;
                int vals=(i==0?1:seg.query(i,i));
                if(vals>0)
                {
                      if(i!=0)
                      seg.update(i,i,-1); 
                      int l1,r1,l2,r2;
                      if(a[ptr]&1)
                      {
                           l1=i+2;
                           r1=l1+(a[ptr]/2)-1;
                           l2=l1;
                           r2=r1;
                      }
                      else
                      {
                           l1=i+2;
                           r1=l1+(a[ptr]/2)-1;
                           l2=l1;
                           r2=r1-1;
                      }
                      seg.update(l1,r1,1);
                      seg.update(l2,r2,1);
                      int bound=seg.bound(k);
                      if(bound!=-1)
                      {
                           if(ans==-1 || ans>bound)
                           ans=bound;
                      }
                      if(vals>1)
                      i--;
                      ptr++;
                }
           }
           cout<<ans<<endl;  
     }
     return 0;
}