#include <bits/stdc++.h>
using namespace std;
bool isans(vector<long long>& v, long long n, long long m, long long p) {
  long long i = 0;
  long long sum = 0;
  long long k = 0;
  while (i < n) {
    long long j = m;
    while (i < n && j > 0) {
      sum += max((long long)0, v[i] - k);
      j--;
      i++;
    }
    k++;
  }
  return sum >= p;
}
int main() {
  long long n, p;
  cin >> n >> p;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.rbegin(), v.rend());
  long long l = 1, r = n;
  long long ans = -1;
  while (l <= r) {
    long long m = (l + r) / 2;
    if (isans(v, n, m, p)) {
      r = m - 1;
      ans = m;
    } else {
      l = m + 1;
    }
  }
  cout << ans;
  return 0;
}
