#include <bits/stdc++.h>
const int N = 1000010, M = 10000010;
int n, m, a[N], dp[M];
void getData() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
}
bool check(int x) {
  for (int i = 0; i < M; ++i) {
    if (i < x)
      dp[i] = 0;
    else if (x <= i && i < x + x)
      dp[i] = 1;
    else
      dp[i] = dp[i / 2] + dp[i - i / 2];
  }
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    sum += dp[a[i]];
    if (sum >= m) return true;
  }
  return false;
}
void solve() {
  int lo, hi, mid, ans = -1;
  lo = 1;
  hi = a[0];
  for (int i = 0; i < n; ++i) hi = std::max(hi, a[i]);
  while (lo <= hi) {
    mid = (lo + hi) >> 1;
    if (check(mid)) {
      lo = mid + 1;
      ans = std::max(ans, mid);
    } else
      hi = mid - 1;
  }
  printf("%d\n", ans);
}
int main() {
  getData();
  solve();
  return 0;
}
