#include <bits/stdc++.h>
using namespace std;
int a[200005];
long long m;
int main() {
  int n;
  scanf("%d %lld", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  sort(a, a + n, greater<int>());
  int l = 1, r = n, ans = n + 1;
  while (l <= r) {
    int mid = (l + r) / 2;
    int i = 0, j = 0;
    long long sum = 0;
    for (int k = 0; k < n; k++) {
      sum += max(0, a[k] - i);
      j++;
      if (j == mid) {
        j = 0;
        i++;
      }
    }
    if (sum >= m) {
      r = mid - 1;
      ans = min(ans, mid);
    } else {
      l = mid + 1;
    }
  }
  if (ans == n + 1) ans = -1;
  printf("%d", ans);
  return 0;
}
