#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2 * 1e5 + 10;
int n, m, a[maxn];
bool cmp(int a, int b) { return a > b; }
bool check(int x) {
  long long sum = 0;
  for (int i = 1, t = 0; i <= n; i++) {
    sum += (a[i] - t);
    if (i % x == 0) t++;
    if (a[i] <= t) break;
  }
  return sum >= m;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n, cmp);
  int l = 1, r = n + 1, ans = 1 << 30;
  while (l < r) {
    int mid = (l + r) / 2;
    if (check(mid))
      r = mid, ans = min(ans, mid);
    else
      l = mid + 1;
  }
  if (ans != 1 << 30)
    printf("%d", ans);
  else
    printf("-1");
  return 0;
}
