#include <bits/stdc++.h>
using namespace std;
int di[] = {0, -1, 0, 1, -1, 1, -1, 1};
int dj[] = {-1, 0, 1, 0, 1, -1, -1, 1};
int MOD = 1e9 + 7;
int const N = 2e5 + 10;
int a[N], n, m;
bool valid(long long x) {
  long long s = 0;
  int c = 0, cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (cnt == x) c++, cnt = 0;
    if (a[i] - c > 0)
      s += a[i] - c;
    else
      break;
    cnt++;
  }
  return s >= m;
}
long long solv() {
  long long st = 1, ed = 1e6;
  long long ans = -1;
  while (st <= ed) {
    long long mid = (st + ed) / 2;
    if (valid(mid))
      ans = mid, ed = mid - 1;
    else
      st = mid + 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n, greater<int>());
  cout << solv();
}
