#include <bits/stdc++.h>
using namespace std;
const int inf = numeric_limits<int>::max();
const long long int linf = numeric_limits<long long int>::max();
const int mod = (int)1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  long long int a[n], sum = 0;
  for (int i = 0; i < (n); ++i) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum < m) {
    cout << "-1\n";
    return 0;
  }
  int start = 1, end = n;
  sort(a, a + n);
  while (start < end) {
    long long int mid = (start + end) / 2;
    long long int sum1 = 0;
    long long int g = n - 1;
    long long int r = 0;
    while (g >= 0) {
      long long int f = 0;
      while (f < mid && g >= 0) {
        sum1 += max(a[g] - r, 0LL);
        g--;
        f++;
      }
      r++;
    }
    if (sum1 >= m)
      end = mid;
    else
      start = mid + 1;
  }
  cout << start << "\n";
  return 0;
}
