#include <bits/stdc++.h>
using namespace std;
long long a[20001];
long long size;
bool f(long long x, long long k) {
  long long i = size, j = 0, temp = 0, ct1 = 0;
  while (i >= 1) {
    j++;
    temp += max(0ll, a[i] - ct1);
    i--;
    if (j == x) {
      ct1++;
      j = 0;
    }
    if (temp >= k) {
      return true;
    }
  }
  return false;
}
int main() {
  long long i, j, k, m, l = 1, r = -1, n, t, ans = 0, temp = 0;
  t = 1;
  while (t--) {
    cin >> n >> k;
    size = n;
    for (i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + n + 1);
    l = 1;
    r = n;
    ans = -1;
    while (l <= r) {
      m = (l + r) / 2;
      if (f(m, k)) {
        ans = m;
        r = m - 1;
      } else
        l = m + 1;
    }
    cout << ans;
  }
  return 0;
}
