#include <bits/stdc++.h>
using namespace std;
long long n, m, a[200005], d[200005];
bool g(long long days) {
  fill(d, d + days, LLONG_MAX);
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (i / days < d[i % days]) {
      ans += a[i] - i / days;
      d[i % days] = min(d[i % days], a[i] + i / days);
    }
    if (ans >= m) return 1;
  }
  return 0;
}
int main() {
  scanf("%lld%lld", &n, &m);
  for (int i = 0; i < n; i++) scanf("%lld", a + i);
  sort(a, a + n, greater<long long>());
  long long l = 1, r = n;
  while (r - l + 1 > 1) {
    long long days = (l + r) / 2;
    if (g(days))
      r = days;
    else
      l = days + 1;
  }
  printf("%lld\n", g(l) ? l : -1);
  return 0;
}
