#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long N = 2e5 + 10;
const long long mod = 1e9 + 7;
long long a[N];
long long n, m;
bool check(long long x) {
  long long sum = 0, cnt = 0;
  long long day = x;
  for (long long i = 1; i <= n; i++) {
    if (day == 0) {
      day = x;
      cnt++;
    }
    sum += max(0LL, a[i] - cnt);
    day--;
    if (sum >= m) return true;
  }
  return false;
}
long long bin_search(long long lo, long long hi) {
  long long ans = -1;
  while (lo <= hi) {
    long long mid = (lo + hi) / 2;
    if (check(mid)) {
      ans = mid;
      hi = mid - 1;
    } else
      lo = mid + 1;
  }
  return ans;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  long long sum = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum < m) {
    cout << -1;
    return 0;
  }
  sort(a + 1, a + n + 1);
  reverse(a + 1, a + n + 1);
  long long ans = bin_search(1, n);
  cout << ans;
  return 0;
}
