#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, left = 1, right, mid, cafein, a[200010], ans = -1, buang;
  scanf("%I64d %I64d", &n, &m);
  for (long long int i = 0; i < n; i++) scanf("%I64d", &a[i]);
  sort(a, a + n);
  reverse(a, a + n);
  right = n;
  while (left <= right) {
    mid = (left + right) / 2;
    cafein = 0;
    for (long long int i = 0; i < n; i++) {
      buang = i / mid;
      cafein += max(0LL, a[i] - buang);
    }
    if (cafein < m)
      left = mid + 1;
    else {
      ans = mid;
      right = mid - 1;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
