#include <bits/stdc++.h>
using namespace std;
int n, k;
long long a[int(2e5 + 5)];
bool check(int x) {
  long long sum = 0;
  for (long long i = 0; i < n; i += x) {
    for (int j = i; j < (min(i + x, n + 0ll)); ++j) {
      sum += max(0ll, a[j] - i / x);
    }
  }
  return sum < k;
}
void solve() {
  sort(a, a + n, greater<int>());
  int low = 1, high = n, mid, ans = n + 1;
  bool f = 0;
  while (high >= low) {
    mid = (low + high) >> 1;
    if (check(mid))
      low = mid + 1;
    else
      high = mid - 1, ans = min(ans, mid);
  }
  cout << (ans == n + 1 ? -1 : ans);
}
int main() {
  int test = 1;
  while (test--) {
    cin >> n >> k;
    for (int i = 0; i < (n); ++i) cin >> a[i];
    solve();
  }
  return 0;
}
