#include <bits/stdc++.h>
using namespace std;
long long n, k, a[200005], s;
bool check(long long x) {
  long long c = 0;
  for (__typeof((n + 1)) i = (1); i < (n + 1); i++)
    c += max(0ll, a[i] - (i - 1) / x);
  return c >= k;
}
void solve() {
  cin >> n >> k;
  for (__typeof((n + 1)) i = (1); i < (n + 1); i++) cin >> a[i], s += a[i];
  if (k > s) {
    cout << -1 << endl;
    return;
  };
  sort(a + 1, a + n + 1);
  reverse(a + 1, a + n + 1);
  long long l = 1, r = n, mid;
  while (r - l > 1) {
    mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  if (check(l)) {
    cout << l << endl;
    return;
  };
  {
    cout << r << endl;
    return;
  };
}
void prep() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  prep();
  cout << fixed << setprecision(12);
  while (t--) solve();
  return 0;
}
