#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  long long l = 1, r = n, ans = INT_MAX;
  while (l <= r) {
    long long mid = l + r >> 1;
    long long t = 0;
    for (int i = 0; i < n; i++) {
      t += max(0LL, v[i] - i / mid);
    }
    if (t >= m) {
      ans = mid, r = mid - 1;
    } else
      l = mid + 1;
  }
  if (ans == INT_MAX)
    cout << -1 << "\n";
  else
    cout << ans << "\n";
}
int main() {
  solve();
  return 0;
}
