#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long s, t, sum = 0;
  cin >> s >> t;
  vector<long long> as(s);
  for (int i = 0; i < s; i++) cin >> as[i], sum += as[i];
  if (sum < t) {
    cout << -1 << endl;
    return;
  }
  sort(as.begin(), as.end());
  reverse(as.begin(), as.end());
  long hi = s, lo = 0;
  while (hi - lo > 1LL) {
    long m = (hi + lo) / 2, tc = t;
    for (long i = 0; i < s; i++) {
      tc -= max(0LL, as[i] - i / m);
    }
    (tc <= 0LL ? hi : lo) = m;
  }
  cout << hi << endl;
}
int main(void) {
  solve();
  return 0;
}
