#include <bits/stdc++.h>
long long arr[200001];
bool cmpx(long long A, long long B) { return (A > B); }
int bs1(int n, long long m) {
  int lo = 1;
  int hi = n;
  while (lo < hi) {
    int mid = lo + (hi - lo) / 2;
    long long sx = 0, df = 0;
    for (int i = 1; i <= n; i++) {
      sx += std::max(0LL, arr[i] - df);
      if (!(i % mid)) df++;
    }
    if (sx < m)
      lo = mid + 1;
    else
      hi = mid;
  }
  return lo;
}
int main(void) {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  int n;
  long long m, sx = 0;
  std::cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    std::cin >> arr[i];
    sx += arr[i];
  }
  if (sx < m)
    std::cout << "-1\n";
  else {
    std::sort(arr + 1, arr + n + 1, cmpx);
    int ans = bs1(n, m);
    std::cout << ans << "\n";
  }
  return 0;
}
