#include <bits/stdc++.h>
using namespace std;
int A[200005];
long long n, m;
bool Check(int d) {
  long long p = 0;
  for (int i = 0; i < n; i++) p += max(0, A[i] - i / d);
  return p >= m;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> A[i];
  sort(A, A + n, greater<int>());
  int l = 1, r = min(m, n), ans = -1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (Check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ans << endl;
  return 0;
}
