#include <bits/stdc++.h>
using namespace std;
const int tam = 100010;
const int MOD = 1000000009;
const int MOD1 = 998244353;
const double EPS = 1e-9;
const double PI = acos(-1);
int ar[200020];
int n;
long long first(int mid) {
  long long res = 0;
  for (int i = 0; i < n; i++) {
    res += max(0, ar[i] - i / mid);
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int m;
  cin >> n >> m;
  long long su = 0;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    su += ar[i];
  }
  if (su < m) {
    cout << -1;
    return 0;
  }
  sort(ar, ar + n);
  reverse(ar, ar + n);
  int lo = 1, hi = n, mid, res;
  while (lo <= hi) {
    mid = (lo + hi) / 2;
    if (first(mid) >= m)
      res = mid, hi = mid - 1;
    else
      lo = mid + 1;
  }
  cout << res << '\n';
  return 0;
}
