#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000003, INF = 0x3f3f3f3f;
int n, m, a[maxn];
bool check(int x) {
  int rest = m;
  for (int i = 1; i <= n; i++) {
    if (a[i] < x) continue;
    int v = a[i], cnt0 = 1, cnt1;
    while (v / 2 >= x) v /= 2, cnt0 <<= 1;
    cnt1 = a[i] - v * cnt0;
    cnt0 -= cnt1;
    if (v + 1 >= x * 2)
      rest -= (cnt0 + cnt1 * 2);
    else
      rest -= (cnt0 + cnt1);
    if (rest <= 0) return 1;
  }
  return 0;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  int l = 1, r = 10000000, mid, ans = -1;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid))
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  printf("%d\n", ans);
  return 0;
}
