#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first == b.first) return (a.second < b.second);
  return (a.first < b.first);
}
vector<long long int> prime(1000005, 1);
void p() {
  long long int i, j;
  for (i = 2; i <= 1000000; i++) {
    if (prime[i] == 1) {
      for (j = 2 * i; j <= 1000000; j += i) prime[j] = 0;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, s, i;
  cin >> n >> s;
  vector<long long int> a(n);
  for (i = 0; i < (n); i++) cin >> a[i];
  sort(a.begin(), a.end());
  long long int sum = 0;
  for (i = 0; i < (n); i++) sum += a[i];
  if (sum < s)
    cout << -1 << "\n";
  else {
    long long int ans = 0;
    long long int left = 0, mid;
    long long int right = a[0];
    while (left <= right) {
      mid = left + (right - left) / 2;
      if (sum - mid * n >= s) {
        ans = mid;
        left = mid + 1;
      } else
        right = mid - 1;
    }
    cout << ans << "\n";
  }
  return 0;
}
