#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
const int M = 1e4 + 5;
int n, m, w, vis[N], l[N], r[N];
long long a[N], ans[N], s;
int main() {
  cin >> n >> s;
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum < s) {
    cout << -1 << endl;
    return 0;
  } else if (sum == s) {
    cout << 0 << endl;
    return 0;
  }
  sort(a + 1, a + 1 + n);
  int now = 1;
  sum = s;
  while (a[now] == a[1]) {
    now++;
  }
  for (int i = n; i >= now; i--) {
    sum -= (a[i] - a[1]);
  }
  if (sum) {
    int cnt = 0;
    while (sum > 0) {
      sum -= n;
      cnt++;
    }
    cout << a[1] - cnt << endl;
  } else {
    cout << a[1] << endl;
  }
  return 0;
}
