#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll n, s;
  cin >> n >> s;
  vector<ll> v(n);
  for (ll i = (0); i < (n); ++i) cin >> v[i];
  ll m = *min_element((v).begin(), (v).end());
  ll t = 0;
  for (ll i = (0); i < (n); ++i) t += v[i];
  t -= s;
  if (t < 0) {
    cout << -1 << endl;
  } else {
    cout << min(m, t / n) << endl;
  }
  return 0;
}
