#include <bits/stdc++.h>
using namespace std;
long long a[200001];
long long n, m;
bool judge(long long x) {
  if (x == 0) return false;
  long long sum = 0, cnt = 0, cur = 0;
  for (long long i = 1; i <= n; i++) {
    if (cur == x) {
      cur = 0, cnt++;
    }
    sum += max(a[i] - cnt, 0ll);
    cur++;
  }
  return sum >= m;
}
bool cmp(long long a, long long b) { return a > b; }
signed main() {
  scanf("%I64d%I64d", &n, &m);
  for (long long i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  sort(a + 1, a + n + 1, cmp);
  long long l = 0, r = 1000000;
  for (long long i = 1; i <= 100; i++) {
    long long mid = (l + r) / 2;
    if (judge(mid))
      r = mid;
    else
      l = mid;
  }
  if (r == 1000000) {
    printf("-1");
    return 0;
  }
  printf("%I64d", r);
  return 0;
}
