#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265359;
const int MAX = 1e6 + 2;
const long long int inf = 1e18;
const int N = 1010;
const long long int mod = 1e9 + 7;
inline long long int add(long long int a, long long int b) {
  a += b;
  if (a >= mod) a -= mod;
  return a;
}
inline long long int mul(long long int a, long long int b) {
  return (((a + mod) % mod) * (b + mod) % mod) % mod;
}
inline long long int power(long long int a, long long int b) {
  long long int rt = 1;
  while (b > 0) {
    if (b & 1) rt = mul(rt, a);
    a = mul(a, a);
    b >>= 1;
  }
  return rt;
}
inline long long int modInverse(long long int n, long long int p) {
  return power(n, p - 2) % p;
}
long long int i, j, k, l, m, r, n;
long long int a[MAX], b[MAX];
long long int check(long long int days) {
  long long int p = 0;
  for (i = 0; i < days; i++) {
    p += a[i];
    j = i + days;
    k = 1;
    while (j < n && a[j] - k > 0) {
      p += max(0LL, a[j] - k);
      k++;
      j += days;
    }
  }
  return p;
}
void stArt() {}
void eNd() {}
int main() {
  stArt();
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  long long int sm = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    sm += a[i];
  }
  if (sm < m) {
    cout << "-1";
    return 0;
  }
  sort(a, a + n, greater<long long int>());
  long long int ans = n;
  l = 1, r = 200000;
  while (l <= r) {
    long long int mid = (l + r) / 2;
    if (check(mid) >= m) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ans;
  eNd();
  return 0;
}
