#include <bits/stdc++.h>
using namespace std;
long long n, b[212345], m;
int cmp(long long a, long long b) { return a > b; }
int check(int x) {
  long long tot = 0;
  long long tmp = 0, cnt = 0;
  for (int i = 1; i <= n; i++) {
    tot += max((long long)0, b[i] - cnt);
    if (tot >= m) return 1;
    tmp++;
    if (tmp == x) {
      tmp = 0, cnt++;
    }
  }
  return 0;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%lld", &b[i]);
  sort(b + 1, b + 1 + n, cmp);
  long long l = 1, r = n, mid, ans = -1;
  while (l <= r) {
    mid = l + r >> 1;
    if (check(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  cout << ans << endl;
}
