#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 10;
vector<long long> a(N);
long long n, k;
bool check(long long x) {
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += max(0LL, a[i] - i / x);
    if (ans >= k) return 1;
  }
  return 0;
}
int32_t main() {
  cin >> n >> k;
  a.resize(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a.rbegin(), a.rend());
  long long l = 0;
  long long r = n + 2;
  while (r - l > 1) {
    long long mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  if (r == n + 2)
    cout << -1;
  else
    cout << r;
}
