#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, s;
  cin >> n >> s;
  vector<long long> v(n);
  long long sum = 0, minimum = 1e9;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    sum += v[i];
    if (v[i] < minimum) minimum = v[i];
  }
  sum -= s;
  if (sum < 0)
    cout << -1 << endl;
  else
    cout << min(minimum, sum / n) << endl;
  return 0;
}
