#include <bits/stdc++.h>
using namespace std;
long long a[200005];
long long n, m, ss = 0;
long long query(long long k) {
  long long val = 0;
  for (int i = n; i > n - k; i--) {
    val += a[i];
  }
  if (val >= m) {
    return 1;
  }
  long long r = -1;
  long long j = n - k, t, flag = 0;
  while (j >= 1) {
    t = k;
    while (t--) {
      if (a[j] + r > 0) {
        val += (a[j] + r);
      } else {
        flag = 1;
        break;
      }
      j--;
    }
    if (flag) {
      break;
    }
    r--;
  }
  if (val >= m) {
    return 1;
  } else {
    return -1;
  }
}
int main() {
  scanf("%lld %lld", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    ss += a[i];
  }
  if (ss < m) {
    printf("-1\n");
    return 0;
  }
  sort(a + 1, a + 1 + n);
  long long x = 1, y = n, op, ans;
  while (x <= y) {
    long long mid = (x + y) >> 1;
    op = query(mid);
    if (op == 1) {
      y = mid;
    }
    if (op == -1) {
      x = mid;
    }
    if (x == y) {
      ans = x;
      break;
    }
    if (x == y - 1) {
      if (query(x) == 1) {
        ans = x;
        break;
      }
      ans = y;
      break;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
