#include <bits/stdc++.h>
using namespace std;
long long m;
vector<long long> a;
bool cmp(long long r1, long long r2) { return r1 > r2; }
bool check(long long k) {
  long long res = 0;
  for (long long i = 0; i < a.size(); i++) {
    res += max((long long)0, a[i] - i / k);
  }
  return res >= m;
}
int main() {
  long long n, l, r;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    long long c;
    cin >> c;
    a.push_back(c);
  }
  sort(a.begin(), a.end(), cmp);
  r = n;
  l = 1;
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  if (check(l) == true)
    cout << l;
  else if (check(r) == true)
    cout << r;
  else
    cout << -1;
  return 0;
}
