#include <bits/stdc++.h>
using namespace std;
int const N = 2e5 + 5;
long long a[N];
long long m;
long long n;
bool check(long long days, long long page) {
  long long sum = 0;
  for (int i = 0; i < days; i++) sum += a[i];
  ;
  for (int i = days; i < n; i++)
    sum += max((long long)0, a[i] - ((long long)i / days));
  if (sum >= page) return true;
  return false;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  reverse(a, a + n);
  long long l = 1, h = n + 1;
  while (l < h) {
    long long mid = (l + h) / 2;
    if (check(mid, m))
      h = mid;
    else
      l = mid + 1;
  }
  if (l == n + 1)
    cout << -1 << endl;
  else
    cout << l << endl;
}
