#include <bits/stdc++.h>
using namespace std;
bool solve(long long arr[], long long n, long long days, long long m) {
  int x = 0;
  for (int i = 0; i < n; ++i) {
    if (i && i % days == 0) ++x;
    int contri = arr[i] - x;
    contri = max(contri, 0);
    m -= contri;
  }
  return m <= 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long sum = 0;
  long long arr[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    sum += arr[i];
  }
  if (sum < m) {
    cout << "-1";
    return 0;
  }
  sort(arr, arr + n, greater<int>());
  long long low = 1, high = n;
  long long ans = n;
  while (low <= high) {
    int mid = low + (high - low) / 2;
    if (solve(arr, n, mid, m)) {
      ans = mid;
      high = mid - 1;
    } else
      low = mid + 1;
  }
  cout << ans;
}
