#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
long long int t, n, m, j, ans, k, a, b, c, d, e, f, sum, i, sz;
string s, s2, s3, s4;
vector<long long int> v;
int ar[(int)(1e6 + 10)], ar2[(int)(1e6 + 10)];
void brainfuck();
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  brainfuck();
  return 0;
}
void brainfuck() {
  cin >> n >> m;
  b = INT_MAX;
  for (i = 1; i <= n; i++) {
    cin >> a;
    v.push_back(a);
    b = min(a, b);
    sum += a;
  }
  if (sum < m) {
    cout << "-1";
    return;
  }
  a = 0;
  for (i = 1; i <= n; i++) {
    a += abs(v[i - 1] - b);
    v[i - 1] = b;
  }
  if (m <= a) {
    cout << b;
    return;
  }
  c = m - a;
  d = c / n;
  if (!d) d = 1;
  if (d * n >= c) {
    cout << v[0] - d;
    return;
  } else
    cout << v[0] - d - 1;
}
