#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> vec;
bool vaild(int x) {
  long long sum = 0;
  for (int i = 0; i < n; i++) sum += max(0, vec[i] - (i / x));
  return sum >= k;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    vec.push_back(x);
  }
  sort(vec.rbegin(), vec.rend());
  int l = 1, r = n, ans = -1;
  while (l <= r) {
    int mid = (r + l) / 2;
    if (vaild(mid))
      r = mid - 1, ans = mid;
    else
      l = mid + 1;
  }
  cout << ans;
  return 0;
}
