#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
bool is_good(int X, int *array, int k, int n) {
  if (X == 0) {
    return 0;
  }
  long long int ans = 0;
  int p = -1;
  for (int i = 0; i < n; ++i) {
    if (i % X == 0) {
      p++;
    }
    ans += max(0, (array[i] - p));
  }
  if (ans >= k) {
    return true;
  }
  return false;
}
void solve() {
  int n;
  cin >> n;
  int k;
  cin >> k;
  long long int sum = 0;
  int array[n];
  for (int i = 0; i < n; ++i) {
    cin >> array[i];
    sum += array[i];
  }
  sort(array, array + n, greater<int>());
  if (sum < k) {
    cout << -1 << endl;
    return;
  }
  int start = 0;
  int end = 1000000000;
  for (int i = 0; i < 100; ++i) {
    int mid = (start + end) / 2;
    if (is_good(mid, array, k, n)) {
      end = mid;
    } else
      start = mid;
  }
  cout << end << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
