#include <bits/stdc++.h>
using namespace std;
void q1() {
  long long int n;
  cin >> n;
  long long int arr[n];
  long long int maxi = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] >= arr[maxi]) maxi = i;
  }
  maxi = 0;
  long long int total = 0;
  for (long long int i = 0; i < n; i++) {
    long long int c1 = 2 * (abs(maxi - i) + abs(i - 0) + abs(maxi));
    if (i != 0)
      c1 *= arr[i];
    else
      c1 = 0;
    total += c1;
  }
  cout << total << "\n";
}
void q2() {
  long long int n, s;
  cin >> n >> s;
  long long int mi = INT_MAX;
  long long int sum = 0;
  for (long long int i = 0; i < n; i++) {
    long long int temp;
    cin >> temp;
    sum += temp;
    if (temp < mi) mi = temp;
  }
  if (sum < s)
    cout << "-1";
  else {
    sum -= s;
    cout << min(sum / n, mi);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  q2();
  return 0;
}
