#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n;
long long a[maxn], m;
bool ispossible(int d) {
  if (d < 1) return false;
  int cur = 1, k = 0;
  long long tot = 0;
  for (int i = 0; i < n; i++) {
    tot += max(0ll, a[i] - k);
    if (cur == d)
      cur = 1, k++;
    else
      cur++;
  }
  if (tot >= m)
    return true;
  else
    return false;
}
int solve(int s, int e) {
  if (s > e) return -1;
  int d = (s + e) / 2;
  if (ispossible(d) and !ispossible(d - 1))
    return d;
  else if (ispossible(d))
    return solve(s, d - 1);
  else
    return solve(d + 1, e);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n, greater<long long>());
  cout << solve(1, n);
  return 0;
}
