#include <bits/stdc++.h>
using namespace std;
vector<long long> s;
vector<long long>::iterator it;
long long n, m, a;
long long sum = 0;
int main() {
  cin >> n >> m;
  for (long long i = 0; i < n; ++i) {
    cin >> a;
    s.push_back(a);
    sum += a;
  }
  if (m > sum)
    cout << -1 << endl;
  else {
    sort(s.begin(), s.end(), greater<long long>());
    long long l = 1, r = n;
    while (l <= r) {
      long long mid = (l + r) / 2, ans = 0, temp = 0;
      it = s.begin();
      while (it != s.end()) {
        long long cnt = 0;
        while (cnt < mid && it != s.end()) {
          ans += max((long long)0, *it - temp);
          ++it, ++cnt;
        }
        ++temp;
      }
      if (ans < m)
        l = mid + 1;
      else
        r = mid - 1;
    }
    cout << l << endl;
  }
}
