#include <bits/stdc++.h>
using namespace std;
inline bool ok(long long &mid, vector<long long> &a, long long &n,
               long long &m) {
  long long temp = 0;
  for (long long j = 0; j < mid; j++) {
    long long sub = 0;
    for (long long k = j; k < n; k += mid) {
      temp += max(0ll, a[k] - sub);
      sub++;
    }
  }
  if (temp >= m) {
    return true;
  }
  return false;
}
void solve() {
  long long n, m;
  cin >> n >> m;
  vector<long long> a(n);
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum < m) {
    cout << -1;
    return;
  }
  if (sum == m) {
    cout << n;
    return;
  }
  long long xtra = sum - m;
  sort(a.rbegin(), a.rend());
  long long l = 0, r = n + 1;
  while (l + 1 < r) {
    long long mid = (l + r) / 2;
    if (ok(mid, a, n, m)) {
      r = mid;
    } else
      l = mid;
  }
  cout << l + 1;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
