#include <bits/stdc++.h>
using namespace std;
long long cont[1005];
int main() {
  ios::sync_with_stdio(0);
  long long n, m;
  cin >> n >> m;
  long long sum = 0;
  long long Min = 1e18;
  for (int i = 0; i < n; i++) {
    cin >> cont[i];
    sum += cont[i];
    Min = min(Min, cont[i]);
  }
  if (sum < m) {
    cout << -1 << endl;
    exit(0);
  }
  int ans = 0;
  for (int i = 1 << 30; i; i >>= 1) {
    int test = ans + i;
    long long s = 0;
    for (int j = 0; j < n; j++) {
      s += cont[j] - test;
    }
    if (s >= m && test <= Min) {
      ans = test;
    }
  }
  cout << ans << endl;
}
