#include <bits/stdc++.h>
using namespace std;
bool check(vector<long long int> a, long long int mid, long long int k,
           long long int &ans) {
  long long int n = a.size();
  long long int temp = 0;
  long long int c = a[n - 1];
  ;
  for (long long int i = n - 1; i >= 0; i--) {
    if (a[i] >= mid) {
      temp += (a[i] - mid);
      c = min(c, mid);
    }
  }
  if (temp >= k) {
    ans = max(ans, min(a[0], c));
    return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  vector<long long int> a(n);
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (k > sum) {
    cout << -1;
    return 0;
  }
  sort(a.begin(), a.end());
  long long int s = 0;
  long long int e = 1000000000;
  long long int ans = 0;
  while (s <= e) {
    long long int mid = s + (e - s) / 2;
    if (check(a, mid, k, ans)) {
      s = mid + 1;
    } else {
      e = mid - 1;
    }
  }
  cout << ans;
  return 0;
}
