#include <bits/stdc++.h>
using namespace std;
const long long N = 100005;
long long A[N];
long long fnc(long long h, long long n) {
  long long sum = 0;
  for (__typeof((n)) i = (1); i <= (n); i++) {
    if (A[i] >= h) sum += A[i] - h;
  }
  return sum;
}
void solve() {
  long long n, k, x;
  cin >> n >> k;
  long long sum = 0;
  long long mx = LLONG_MAX;
  for (__typeof((n)) i = (1); i <= (n); i++) {
    cin >> A[i];
    sum += A[i];
    mx = min(mx, A[i]);
  }
  if (k > sum) {
    cout << -1 << '\n';
    return;
  }
  long long ans = 0;
  long long low = 0;
  long long high = mx;
  while (high - low >= 0) {
    long long mid = (low + high) / 2;
    if (fnc(mid, n) >= k) {
      ans = mid;
      low = mid + 1;
    } else
      high = mid - 1;
  }
  cout << ans << '\n';
}
signed main() {
  long long t;
  ios_base::sync_with_stdio(false);
  t = 1;
  while (t--) solve();
  return 0;
}
