#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k;
  cin >> n >> k;
  long long int a[n];
  for (long long int i = 0; i < n; i = i + 1) cin >> a[i];
  sort(a, a + n);
  long long int extra = 0;
  long long int sum = a[0];
  for (long long int i = n - 1; i > 0; i = i - 1) {
    extra += (a[i] - a[0]);
    sum += a[i];
  }
  if (k > sum) {
    cout << -1 << endl;
    return 0;
  }
  if (k <= extra) {
    cout << a[0] << endl;
    return 0;
  }
  k = k - extra;
  long long int q = k / n;
  bool r = k % n;
  long long int ans = a[0] - (q + r);
  cout << ans << endl;
}
