#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
bool Check(int day_cnt, const vector<int> &a, ll m) {
  int n = a.size();
  for (int i = 0; i < n; i++) {
    int d = i / day_cnt;
    m -= max(0, a[i] - d);
  }
  return m <= 0;
}
int main(int argc, char **argv) {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int l = 1, r = n;
  int res = -1;
  while (l <= r) {
    int mid = l + (r - l) / 2;
    if (Check(mid, a, m)) {
      res = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  printf("%d\n", res);
  return 0;
}
