#include <bits/stdc++.h>
using namespace std;
long long a[200005], k[200005];
long long cmp(long long x, long long y) { return x > y; }
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
    sort(a + 1, a + n + 1, cmp);
    long long ans = 0;
    int l = 1, r = n;
    while (l <= r) {
      int mid = (l + r) / 2;
      memset(k, 0, sizeof(k));
      long long v = 0;
      for (int i = 1; i <= n; i++) {
        k[i % mid] += max(v, a[i] - ((i - 1) / mid));
      }
      ans = 0;
      for (int i = 0; i < mid; i++) ans += k[i];
      if (ans < m)
        l = mid + 1;
      else
        r = mid - 1;
    }
    if (ans && l <= n)
      printf("%d\n", l);
    else
      printf("-1\n");
  }
}
