#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int coffee[n];
  for (int i = 0; i < n; i++) cin >> coffee[i];
  sort(coffee, coffee + n, greater<int>());
  int L = 1, R = n, mid, ans = -1;
  while (L <= R) {
    mid = (L + R) / 2;
    long long sum = 0;
    for (int i = 0; i < n; i++) sum += max(0, coffee[i] - (i / mid));
    if (sum >= m) {
      ans = mid;
      R = mid - 1;
    } else {
      L = mid + 1;
    }
  }
  cout << ans;
  return 0;
}
