#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
long long n, m;
long long a[N];
bool check(long long mid) {
  long long cnt = 0, ans(0);
  for (long long i = 1; i <= n; i += mid) {
    long long midd = mid, j;
    for (j = i; midd-- && j <= n; j++) {
      ans += max(a[j] - cnt, 0LL);
    }
    ++cnt;
  }
  return ans >= m;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long ans = -1;
  cin >> n >> m;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  sort(a + 1, a + 1 + n, greater<long long>());
  long long lo = 1, hi = n, mid;
  while (lo <= hi) {
    mid = lo + hi >> 1;
    if (check(mid)) {
      hi = mid - 1;
      ans = mid;
    } else
      lo = mid + 1;
  }
  cout << ans;
  return 0;
}
