#include <bits/stdc++.h>
using namespace std;
int n;
int aux;
long long work;
vector<int> coffee;
bool possible(int days) {
  int day = 0;
  long long ans = 0;
  for (int i = 1; i < n + 1; i++) {
    ans += max(0, coffee[i - 1] - day);
    if (i % days == 0) day++;
  }
  return ans >= work;
}
int main() {
  cin >> n >> work;
  long long total = 0;
  for (int i = 0; i < n; i++) {
    cin >> aux;
    total += aux;
    coffee.push_back(aux);
  }
  if (work > total) {
    cout << "-1\n";
    return 0;
  }
  sort(coffee.begin(), coffee.end());
  reverse(coffee.begin(), coffee.end());
  int ans;
  int ini = 1, fin = n + 1;
  while (ini <= fin) {
    int mid = (ini + fin) / 2;
    if (possible(mid)) {
      ans = mid;
      fin = mid - 1;
    } else {
      ini = mid + 1;
    }
  }
  cout << ans << "\n";
  return 0;
}
