#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, s;
  cin >> n >> s;
  long long int min = INT_MAX;
  unsigned long long int sum = 0;
  long long int i;
  long long int arr[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
    if (arr[i] < min) min = arr[i];
  }
  if (sum < s) {
    cout << "-1";
    return 0;
  }
  if (sum == s) {
    cout << "0";
    return 0;
  }
  long long int count = 0;
  for (i = 0; i < n; i++) {
    if (arr[i] > min) count++;
  }
  for (i = 0; i < n; i++) {
    if (count <= 0) break;
    if (arr[i] > min) {
      count -= 1;
      if (s - (arr[i] - min) <= 0) {
        cout << min;
        return 0;
      }
      s = s - (arr[i] - min);
      arr[i] = min;
    }
  }
  while (s != 0 && min >= 0) {
    if (s - (n) <= 0) {
      cout << (min - 1);
      return 0;
    } else {
      min--;
      s = s - n;
    }
  }
  cout << "-1";
  return 0;
}
