#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1100;
int n;
long long s, v[MAXN];
int main() {
  ios::sync_with_stdio(0);
  while (cin >> n >> s) {
    long long S = 0, maxi = 1, mini = 1e9 + 1;
    for (int i = (0); i < (n); i++) {
      cin >> v[i];
      maxi = max(maxi, v[i]);
      mini = min(mini, v[i]);
      S += v[i];
    }
    if (S < s)
      cout << -1 << endl;
    else {
      long long a = 0, b = maxi;
      while (b - a > 1) {
        long long c = (a + b) / 2;
        long long ss = 0;
        for (int i = (0); i < (n); i++)
          if (v[i] > c) ss += v[i] - c;
        if (ss >= s)
          a = c;
        else
          b = c;
      }
      cout << min(mini, a) << endl;
    }
  }
  return 0;
}
