#include <bits/stdc++.h>
using namespace std;
template <typename T>
T id(T b) {
  return b;
};
template <class It>
bool all(It f, It l) {
  return std::all_of(f, l, id<bool>);
}
template <class It>
bool any(It f, It l) {
  return std::any_of(f, l, id<bool>);
}
const int MAX_N = 200000;
int n;
int64_t m;
int64_t a[MAX_N];
bool check(int64_t k) {
  int64_t energy = 0, c = 0;
  for (int64_t i = 0; i < n; i += k) {
    for (int64_t j = 0; j < k && i + j < n; j++) {
      int64_t v = a[i + j] - c;
      if (v >= 0) energy += v;
    }
    c++;
  }
  return energy >= m;
}
int main() {
  cin >> n >> m;
  int64_t total = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    total += a[i];
  }
  if (total < m) {
    cout << -1 << endl;
    return 0;
  }
  sort(a, a + n);
  reverse(a, a + n);
  int64_t l = 0, r = m;
  while (r - l > 1) {
    int64_t m = (l + r) / 2;
    if (check(m))
      r = m;
    else
      l = m;
  }
  cout << r << endl;
  return 0;
}
