#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, vector<T>&& object) {
  for (auto& i : object) {
    os << i;
  }
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<vector<T>>&& object) {
  for (auto& i : object) {
    os << i << endl;
  }
  return os;
}
const size_t MAX_N = (long long)2e5 + 10;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, s, sum = 0;
  cin >> n >> s;
  vector<long long> a(n);
  for (auto& i : a) {
    cin >> i;
    sum += i;
  }
  if (sum < s) {
    cout << "-1\n";
    return 0;
  }
  sort(a.begin(), a.end(), less<long long>());
  long long cmin = a[0];
  long long accv = 0;
  for (auto& i : a) {
    accv += i - cmin;
    i = cmin;
  }
  if (accv >= s) {
    cout << cmin << "\n";
    return 0;
  } else {
    cout << max(0LL, cmin - (long long)ceil(((long double)s - accv) / n))
         << endl;
  }
  return 0;
}
