#include <bits/stdc++.h>
using namespace std;
namespace io {
template <typename First, typename Second>
ostream &operator<<(ostream &os, const pair<First, Second> &p) {
  return os << p.first << " " << p.second;
}
template <typename First, typename Second>
ostream &operator<<(ostream &os, const map<First, Second> &mp) {
  for (auto it : mp) {
    os << it << endl;
  }
  return os;
}
template <typename First>
ostream &operator<<(ostream &os, const vector<First> &v) {
  bool space = false;
  for (First x : v) {
    if (space) os << " ";
    space = true;
    os << x;
  }
  return os;
}
template <typename First>
ostream &operator<<(ostream &os, const set<First> &st) {
  bool space = false;
  for (First x : st) {
    if (space) os << " ";
    space = true;
    os << x;
  }
  return os;
}
template <typename First>
ostream &operator<<(ostream &os, const multiset<First> &st) {
  bool space = false;
  for (First x : st) {
    if (space) os << " ";
    space = true;
    os << x;
  }
  return os;
}
template <typename First, typename Second>
istream &operator>>(istream &is, pair<First, Second> &p) {
  return is >> p.first >> p.second;
}
template <typename First>
istream &operator>>(istream &is, vector<First> &v) {
  for (First &x : v) {
    is >> x;
  }
  return is;
}
long long fastread() {
  char c;
  long long d = 1, x = 0;
  do c = getchar();
  while (c == ' ' || c == '\n');
  if (c == '-') c = getchar(), d = -1;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return d * x;
}
static bool sep = false;
using std::to_string;
string to_string(bool x) { return (x ? "true" : "false"); }
string to_string(const string &s) { return "\"" + s + "\""; }
string to_string(const char *s) { return "\"" + string(s) + "\""; }
string to_string(const char &c) {
  string s;
  s += c;
  return "\'" + s + "\'";
}
template <typename First, typename Second>
string to_string(pair<First, Second> p) {
  return "{" + to_string(p.first) + ", " + to_string(p.second) + "}";
}
template <typename Type>
string to_string(vector<Type> v) {
  bool sep = false;
  string s = "[";
  for (Type x : v) {
    if (sep) s += ", ";
    sep = true;
    s += to_string(x);
  }
  s += "]";
  return s;
}
template <typename Collection>
string to_string(Collection collection) {
  bool sep = false;
  string s = "{";
  for (auto x : collection) {
    if (sep) s += ", ";
    sep = true;
    s += to_string(x);
  }
  s += "}";
  return s;
}
void print() {
  cerr << endl;
  sep = false;
}
template <typename First, typename... Other>
void print(First first, Other... other) {
  if (sep) cerr << " | ";
  sep = true;
  cerr << to_string(first);
  print(other...);
}
}  // namespace io
using namespace io;
const long long INF = (long long)1e9 + 10;
const long long MAXN = (long long)1e6 + 10;
long long cnt[MAXN * 10 + 10], a[MAXN];
long long f(long long m, long long k, long long n) {
  if (m <= 0) return 0;
  for (long long i = 1; i <= n; i++) {
    cnt[a[i]]++;
  }
  long long ret = 0;
  for (long long i = 10 * MAXN; i >= m; i--) {
    if (i / 2 >= m) {
      cnt[i / 2] += cnt[i];
      cnt[(i + 1) / 2] += cnt[i];
    } else {
      ret += cnt[i];
      if (ret >= k) return 1;
    }
  }
  return 0;
}
void solution(istream &cin, ostream &cout, const long long &test_case) {
  long long n, k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long l = -1, r = MAXN * 10;
  while (r - l > 1) {
    long long m = (l + r) >> 1;
    if (f(m, k, n)) {
      l = m;
    } else {
      r = m;
    }
    fill(cnt, cnt + MAXN * 10, 0);
  }
  cout << l << endl;
}
int32_t main() {
  ios::sync_with_stdio(0);
  long long t = 1;
  for (long long i = 1; i <= t; i++) solution(cin, cout, i);
}
