#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<long long, pair<long long, long long> > &a,
               const pair<long long, pair<long long, long long> > &b) {
  if (a.first == b.first)
    return (a.second.second < b.second.second);
  else
    return (a.first < b.first);
}
int main() {
  long long t, i, j, k, l, m, n;
  cin >> n >> m;
  long long a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  long long lb = 0, ub = n + 1;
  long long ans = 1000000000000;
  while (ub - lb > 1) {
    long long mid = (lb + ub) / 2;
    long long cur = 0, cnt = 0;
    long long sum = 0;
    for (i = n - 1; i >= 0; i--) {
      sum += max(0LL, a[i] - cur);
      cnt++;
      if (cnt == mid) {
        cnt = 0;
        cur++;
      }
    }
    if (sum >= m) {
      ans = min(ans, mid);
      ub = mid;
    } else
      lb = mid;
  }
  if (ans == 1000000000000) ans = -1;
  cout << ans << endl;
}
