#include <bits/stdc++.h>
using namespace std;
int n, m;
long long a[1000000];
int check(long long d) {
  if (d <= 0) return 0;
  long long x = -1;
  long long ret = 0;
  for (int i = 0; i < n; ++i) {
    if (i % d == 0) {
      x++;
    }
    ret += max(0ll, a[i] - x);
  }
  return ret >= m;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%lld", &a[i]);
  sort(a, a + n, greater<long long>());
  long long l = 0, r = m;
  while (l + 1 < r) {
    long long mid = (l + r) >> 1;
    if (check(mid)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  if (!check(r))
    cout << -1 << endl;
  else
    cout << r << endl;
}
