#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int _inf = 0xc0c0c0c0;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long _INF = 0xc0c0c0c0c0c0c0c0;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long ksm(long long a, long long b, long long mod) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
long long inv2(long long a, long long mod) { return ksm(a, mod - 2, mod); }
long long arr[200025];
bool cmp(long long a, long long b) { return a > b; }
int main() {
  int n, ans;
  long long m;
  long long sum = 0;
  scanf("%d%lld", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%lld", &arr[i]), sum += arr[i];
  sort(arr + 1, arr + 1 + n, cmp);
  if (sum < m) {
    printf("-1\n");
    return 0;
  } else {
    int l = 1, r = n;
    while (l <= r) {
      int k = 0, cnt = 1;
      long long tmp = 0;
      int mid = (l + r) >> 1;
      while (cnt <= n) {
        tmp += max(arr[cnt] - k, 1ll * 0);
        if (tmp >= m) break;
        if (cnt % mid == 0) {
          k++;
        }
        cnt++;
      }
      if (tmp >= m)
        ans = mid, r = mid - 1;
      else
        l = mid + 1;
    }
    printf("%d\n", max(1, ans));
  }
  return 0;
}
