#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
long long a[maxn];
long long m;
int n;
bool solve(int k) {
  long long i, j, sum = 0, cnt = 0;
  i = 0;
  while (i < n) {
    j = 0;
    while (i < n && j < k) {
      sum = sum + max(0LL, a[i] - cnt);
      j++;
      i++;
    }
    cnt++;
  }
  if (sum >= m)
    return true;
  else
    return false;
}
int main() {
  cin >> n >> m;
  int i;
  long long sum = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum < m) {
    cout << -1 << endl;
    return 0;
  }
  sort(a, a + n, greater<int>());
  int low = 1, high = n;
  bool flag;
  while (low < high) {
    int mid = (low + high) / 2;
    flag = solve(mid);
    if (flag)
      high = mid;
    else
      low = mid + 1;
  }
  cout << low << endl;
  return 0;
}
