#include <bits/stdc++.h>
using namespace std;
long long ceil(long long x, long long y) {
  if (!(x % y)) return (x / y);
  return (x / y) + 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long n, m, x, y, b;
  long long ans = LONG_MIN;
  cin >> n >> m;
  long long a[n];
  long long mi = LONG_MAX;
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
    mi = min(mi, a[i]);
  }
  if (sum < m) {
    cout << "-1";
    return 0;
  }
  long long diff = 0;
  for (long long i = 0; i < n; i++) {
    diff += a[i] - mi;
  }
  if (diff >= m) {
    cout << mi << endl;
    return 0;
  }
  cout << (sum - m) / n << endl;
  return 0;
}
