#include <bits/stdc++.h>
using namespace std;
long long int find(vector<long long int> v, long long int k) {
  long long int co = 0, fo = -1, ze = 0;
  for (long long int i = v.size(); i > 0; i -= k) {
    fo++;
    if (i >= k) {
      for (long long int j = i; j > i - k; j--) {
        co += (max(v[j - 1] - fo, ze));
      }
    } else {
      for (long long int j = i; j > 0; j--) {
        co += (max(v[j - 1] - fo, ze));
      }
    }
  }
  return co;
}
int main() {
  long long int n, m;
  scanf("%lld %lld", &n, &m);
  vector<long long int> v;
  for (long long int i = 0; i < n; i++) {
    long long int c;
    scanf("%lld", &c);
    v.push_back(c);
  }
  sort(v.begin(), v.end());
  if (find(v, n) < m) {
    printf("-1");
    return 0;
  }
  long long int lo = 1, hi = n;
  while (lo < hi) {
    long long int mid = (lo + hi) / 2;
    if (find(v, mid) < m) {
      lo = mid + 1;
    } else if (find(v, mid) == m) {
      printf("%lld", mid);
      return 0;
    } else {
      if (mid == lo || (find(v, mid - 1) < m)) {
        printf("%lld", mid);
        return 0;
      } else {
        hi = mid - 1;
      }
    }
  }
  cout << lo;
}
