#include <bits/stdc++.h>
const long long int mod = 9999999999999983;
long long int primes[6] = {1125899906842597, 1495921043, 1005985879,
                           1495921043,       1005985879, 1495921043};
using namespace std;
int main() {
  int start_s = clock();
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, j, k, n, m, sum = 0, low, high, mid, index, ans = 0, val,
                               value, res = INT_MAX, e;
  cin >> n >> m;
  vector<long long int> arr;
  for (i = 0; i < n; i++) {
    cin >> e;
    arr.push_back(e);
    sum += e;
  }
  if (sum < m) {
    cout << -1 << endl;
    return 0;
  }
  sort(arr.rbegin(), arr.rend());
  low = 0;
  high = n;
  while (low <= high) {
    mid = (low + high) / 2;
    if (mid == 0) {
      low = mid + 1;
      continue;
    }
    index = -1;
    ans = 0;
    for (i = 0; i < n; i++) {
      if (i % mid == 0) index++;
      value = arr[i] - index;
      if (value < 0) value = 0;
      ans = ans + value;
    }
    if (ans >= m) {
      high = mid - 1;
      res = min(res, mid);
    }
    if (ans < m) {
      low = mid + 1;
    }
  }
  cout << res << endl;
}
