#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long a[n];
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a, a + n, greater<int>());
  if (sum < m) {
    cout << "-1\n";
  } else if (sum == m) {
    cout << "0\n";
  } else {
    long long avg = (sum - m) / n;
    for (int i = 0; i < n; i++) {
      if (m <= 0) break;
      if (a[i] > avg) {
        if (m > a[i] - avg) {
          a[i] = avg;
          m -= (a[i] - avg);
        } else {
          a[i] -= m;
          m = 0;
        }
      }
    }
    if (m < 0) {
      cout << "-1\n";
    } else {
      cout << *min_element(a, a + n) << "\n";
    }
  }
  return 0;
}
