#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> a;
  long long x;
  for (long long i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
  long long sum = 0;
  for (auto &i : a) sum += i;
  if (sum < k)
    cout << -1;
  else {
    long long mini = *min_element(a.begin(), a.end());
    if (k > sum - n * mini)
      cout << (sum - k) / n;
    else {
      cout << mini;
    }
  }
}
