#include <bits/stdc++.h>
using namespace std;
int a[200005];
int n, m;
bool can(int x) {
  long long res = 0;
  for (int i = 0; i < n; i++) {
    res += max(0, a[i] - (i / x));
  }
  return res >= m;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n, greater<int>());
  int l = 0, r = n + 1;
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (can(mid))
      r = mid;
    else
      l = mid;
  }
  if (r == n + 1) {
    cout << -1 << endl;
    return 0;
  }
  cout << r << endl;
  return 0;
}
