#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int arr[N];
int n, m;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int i;
  cin >> n >> m;
  long long sum = 0;
  for (i = 1; 1 < n + 1 ? i < n + 1 : i > n + 1; 1 < n + 1 ? i += 1 : i -= 1) {
    cin >> arr[i];
    sum += arr[i];
  }
  if (sum < m) {
    cout << -1 << endl;
    return 0;
  }
  sort(arr + 1, arr + 1 + n, greater<int>());
  int lo = 1, hi = n;
  while (lo < hi) {
    int mid = lo + (hi - lo) / 2;
    int cnt = 0;
    sum = 0;
    for (i = 1; 1 < n + 1 ? i < n + 1 : i > n + 1;
         1 < n + 1 ? i += 1 : i -= 1) {
      sum += max(arr[i] - cnt, 0);
      if (i % mid == 0) cnt++;
    }
    if (sum < m) {
      lo = mid + 1;
    } else
      hi = mid;
  }
  cout << lo << endl;
  return 0;
}
