#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long page;
  cin >> n >> page;
  long long arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  int l = 1, r = n, mid, ans = -1;
  while (l <= r) {
    mid = (l + r) / 2;
    int a = -1;
    long long total = 0;
    for (int i = 0; i < n; i++) {
      if (i % mid == 0) a++;
      if (arr[n - 1 - i] - a < 0) break;
      total += arr[n - 1 - i] - a;
    }
    if (total >= page) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  cout << ans;
}
