#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  long long S;
  cin >> S;
  vector<long long> a(n);
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum < S) {
    cout << -1;
    return 0;
  }
  long long t = *min_element(a.begin(), a.end());
  for (int i = 0; i < n; ++i) {
    long long minus = a[i] - t;
    if (S - minus <= 0) {
      cout << t;
      return 0;
    }
    S -= minus;
    a[i] = t;
  }
  t -= S / n;
  if (S % n) t--;
  cout << t << "\n";
  return 0;
}
