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 <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define curtime chrono::steady_clock::now().time_since_epoch().count
#define rep(i, beg, n, s) for (int i = beg; i < n; i += s)
using ll = long long;
using namespace std;
const double PI = acos(-1);
const int M = 1000000007;
// const int M = 998244353;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int mod(int n, int m = M) {
  int ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}

int exp(int n, int k, int m = M) {
  if (k == 0) return 1;
  if (k == 1) return n;
  int ax = exp(n, k / 2, m);
  ax = mod(ax * ax, m);
  if (k % 2) ax = mod(ax * n, m);
  return ax;
}

int gcd(int a, int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}

int N;
vector<int> st;
vector<int> lz;

// #define PRINT_TEST_CASE
// #define MULTIPLE_TEST_CASE

void push(int cur, int l, int r) {
  if (!lz[cur]) return;
  st[cur] += (r - l + 1) * lz[cur];
  if (l != r) {
    lz[2 * cur] += lz[cur];
    lz[2 * cur + 1] += lz[cur];
  }
  lz[cur] = 0;
}

int qry(int a, int b, int cur = 1, int l = 0, int r = N - 1) {
  push(cur, l, r);
  if (r < a || b < l) return 0;
  if (a <= l && r <= b) return st[cur];
  int m = (l + r) >> 1;
  return qry(a, b, 2 * cur, l, m) + qry(a, b, 2 * cur + 1, m + 1, r);
}

void upd(int a, int b, int val, int cur = 1, int l = 0, int r = N - 1) {
  push(cur, l, r);
  if (r < a || b < l) return;
  if (a <= l && r <= b) {
    lz[cur] += val;
    push(cur, l, r);
    return;
  }
  int m = (l + r) >> 1;
  upd(a, b, val, 2 * cur, l, m);
  upd(a, b, val, 2 * cur + 1, m + 1, r);
  st[cur] = st[2 * cur] + st[2 * cur + 1];
}

void solution(int testcase) {
#ifdef PRINT_TEST_CASE
  cout << "Case #" << testcase << ": ";
#endif
  // Code starts here
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int& x : a) cin >> x;
  sort(all(a), greater<int>());
  N = a[0] + 2000;
  st.clear();
  lz.clear();
  st.resize(4 * N, 0);
  lz.resize(4 * N, 0);

  int ans = INF;

  auto find_depth = [&](int val = 1) {
    int l = 0, r = N - 1;
    int ans = -1;
    while (l <= r) {
      int m = (l + r) >> 1;
      if (qry(0, m) >= val) {
        ans = m;
        r = m - 1;
      } else
        l = m + 1;
    }
    return ans;
  };

  upd(0, 0, 1);

  for (int x : a) {
    int d = find_depth();
    upd(d, d, -1);
    upd(d + 2, d + 2 + (x - 1) / 2 - 1, 1);
    upd(d + 2, d + 2 + (x - 1) - (x - 1) / 2 - 1, 1);

    int nw = find_depth(k);
    ans = min(ans, nw != -1 ? nw : (ll)INF);
  }
  cout << (ans == INF ? -1 : ans) << endl;
}

int32_t main() {
  DESYNC;
  int t = 1;
#ifdef MULTIPLE_TEST_CASE
  cin >> t;
#endif
  for (int _testcase = 1; _testcase <= t; _testcase++) solution(_testcase);
}