#include <bits/stdc++.h>
using namespace std;
int n, k, t, T, x, y, sum, cnt, ans = -1;
long long m, a[200005];
bool check(int mid) {
  long long tot = 0;
  for (int i = (1); i <= (n); i++) {
    tot += max(0LL, a[i] - (i - 1) / mid);
  }
  return tot >= m;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = (1); i <= (n); i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  reverse(a + 1, a + n + 1);
  int lo = 1, hi = n;
  while (lo <= hi) {
    int mid = (lo + hi) >> 1;
    if (check(mid)) {
      hi = mid - 1;
      ans = mid;
    } else
      lo = mid + 1;
  }
  cout << ans << endl;
  return 0;
}
