#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
bool valid(vector<long long>& A, int k, int m) {
  long long sum = 0;
  int n = A.size();
  for (int i = 0; i < n; ++i) {
    sum += max(0LL, A[i] - i / k);
  }
  return sum >= m;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  vector<long long> A(n);
  for (int i = 0; i < n; ++i) {
    cin >> A[i];
  }
  sort(A.begin(), A.end(), greater<long long>());
  long long lo = 1, hi = n, mid;
  long long ans = -1;
  while (lo <= hi) {
    mid = lo + (hi - lo) / 2;
    if (valid(A, mid, m)) {
      ans = mid;
      hi = mid - 1;
    } else {
      lo = mid + 1;
    }
  }
  cout << ans << "\n";
  return 0;
}
