#include <bits/stdc++.h>
using namespace std;
vector<long long> x;
long long n, k;
bool work(long long m) {
  long long j, sum = 0, v = 0;
  for (long long i = 0; i < ceil(double(n) / m); i += 1) {
    for (j = m * i; j < min(m * (i + 1), n); j += 1) {
      sum += max(x[j] - v, 0ll);
    }
    v += 1;
  }
  if (sum >= k) {
    return true;
  }
  return false;
}
int main() {
  long long sum = 0;
  cin >> n >> k;
  x.resize(n);
  for (long long i = 0; i < n; i += 1) {
    cin >> x[i];
    sum += x[i];
  }
  sort(x.rbegin(), x.rend());
  if (sum < k) {
    cout << -1 << endl;
    return 0;
  }
  long long first = 1, last = n;
  while (last - first > 1) {
    long long m = (first + last) / 2;
    if (work(m)) {
      last = m;
    } else {
      first = m + 1;
    }
  }
  if (!work(first)) {
    first = last;
  }
  cout << first << endl;
}
