#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, m;
  cin >> n >> m;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n, greater<long long>());
  long long low = 1, high = n, mid = 0;
  long long ans = -1, sum = 0;
  while (low <= high) {
    mid = (low + high) / 2;
    sum = 0;
    for (long long i = 0; i < n; i++) {
      sum += max((long long)0, (arr[i] - (i / mid)));
    }
    if (sum >= m) {
      ans = mid;
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  cout << ans << endl;
  return 0;
}
