#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, Work;
  cin >> n >> Work;
  long long Caf[200001];
  long long Sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> Caf[i];
    Sum += Caf[i];
  }
  if (Sum < Work) {
    cout << -1 << endl;
    return 0;
  }
  sort(Caf, Caf + n, greater<long long>());
  auto Check = [&](long long Mid, long long n) -> long long {
    long long done = 0, minus = 0;
    for (int i = 0; i < n; i++) {
      done += max(0ll, Caf[i] - minus);
      if ((i + 1) % Mid == 0) minus++;
    }
    return done;
  };
  long long High = n, Low = 1, Ans;
  while (High >= Low) {
    int Mid = (Low + High) / 2;
    long long Score = Check(Mid, n);
    if (Score >= Work) {
      Ans = Mid;
      High = Mid - 1;
    } else {
      Low = Mid + 1;
    }
  }
  cout << Ans << endl;
  return 0;
}
