#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
static int N, M, A[MAXN];
inline bool check(int day) {
  int tot = 0;
  for (int i = 0; i < N; i++)
    if ((tot += max(0, A[i] - i / day)) >= M) return true;
  return false;
}
int main() {
  scanf("%d%d", &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 = -1;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (check(mid))
      r = (ans = mid) - 1;
    else
      l = mid + 1;
  }
  printf("%d\n", ans);
  return 0;
}
