#include <bits/stdc++.h>
using namespace std;
const int chartointdiff = 48;
bool isprime(int x) {
  for (int i = 2; i <= sqrt(x); i++) {
    if (x % i == 0) {
      return 0;
    }
  }
  return 1;
}
bool ispossible(long long minn, unsigned long long s,
                vector<unsigned long long> arr) {
  unsigned long long n = arr.size();
  unsigned long long temp = 0;
  for (int j = 0; j < n; j++) {
    temp += (arr[j] - minn);
  }
  if (temp >= s) {
    return true;
  }
  return false;
}
void solve() {
  unsigned long long n;
  cin >> n;
  unsigned long long s;
  cin >> s;
  vector<unsigned long long> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  unsigned long long summ = 0;
  for (int i = 0; i < n; i++) {
    summ += (arr[i]);
  }
  if (summ < s) {
    cout << -1 << "\n";
    return;
  } else if (summ == s) {
    cout << 0 << "\n";
    return;
  }
  sort(arr.begin(), arr.end());
  unsigned long long temp = 0;
  unsigned long long low = 0;
  long long ans = -1;
  unsigned long long high = arr[0];
  while (low <= high) {
    unsigned long long mid = low + (high - low) / 2;
    if (ispossible(mid, s, arr)) {
      ans = mid;
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  unsigned long long t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
