#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long long INF = 1e7;
signed main() {
  cin.tie(0), ios_base::sync_with_stdio(false);
  ;
  long long n, s;
  cin >> n >> s;
  vector<long long> arr(n);
  long long su = 0, mi = 1e18;
  for (long long i = 0; i < n; ++i) {
    cin >> arr[i];
    su += arr[i];
    if (mi > arr[i]) {
      mi = arr[i];
    }
  }
  su -= s;
  if (su < 0) {
    cout << -1;
    return 0;
  }
  cout << min(su / n, mi);
  return 0;
}
