#include <bits/stdc++.h>
using namespace std;
long long po(long long x, long long y) {
  if (y == 0)
    return 1;
  else
    return x * po(x, y - 1);
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  reverse(a, a + n);
  long long l = 1, r = n;
  long long ans = -1;
  while (l <= r) {
    long long s = 0;
    long long mid = (l + r) / 2;
    for (long long j = 0; j < n; j++) {
      s += max(0ll, a[j] - (j / mid));
    }
    if (s >= m) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  cout << ans;
  return 0;
}
