#include <bits/stdc++.h>
using namespace std;
int dp[10000005];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long L = 1, R = 1e7;
  long long res = -1;
  while (L <= R) {
    long long mid = (L + R) / 2;
    long long temp = 0;
    memset(dp, 0, sizeof(dp));
    for (long long i = mid; i <= 10000000; i++) {
      long long half = i / 2;
      if (half >= mid) {
        dp[i] = dp[half] + dp[i - half];
      } else {
        dp[i] = 1;
      }
    }
    for (long long i = 0; i < n; i++) {
      temp += dp[a[i]];
    }
    if (temp >= k) {
      res = max(res, mid);
      L = (L + R) / 2 + 1;
    } else {
      R = (L + R) / 2 - 1;
    }
  }
  cout << res << "\n";
}
