#include <bits/stdc++.h>
using namespace std;
long long n, x;
vector<long long> v(200005);
bool f(long long k) {
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    long long val = v[i] - i / k;
    ans += max(val, 0ll);
  }
  return ans >= x;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> x;
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v.rbegin(), v.rend());
  long long l = 1, r = n, ans = 2e9;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (f(mid))
      r = mid - 1, ans = mid;
    else
      l = mid + 1;
  }
  if (ans == 2e9) ans = -1;
  cout << ans << endl;
}
