#include <bits/stdc++.h>
int N;
long long M, a[200001], S;
bool check(int mid) {
  long long G = 0;
  for (int i = 1; i <= N; i++) {
    G += std::max(0LL, a[i] - (i - 1) / mid);
    if (G >= M) return true;
  }
  return false;
}
int main() {
  scanf("%d%lld", &N, &M);
  for (int i = 1; i <= N; i++) {
    scanf("%lld", a + i);
    S += a[i];
  }
  std::sort(a + 1, a + N + 1);
  std::reverse(a + 1, a + N + 1);
  if (S < M) {
    puts("-1");
    return 0;
  }
  int l = 1, r = N;
  while (l < r) {
    int m = l + r >> 1;
    if (check(m))
      r = m;
    else
      l = m + 1;
  }
  printf("%d\n", l);
  return 0;
}
