#include <bits/stdc++.h>
using namespace std;
int arr[200100];
int n, m;
long long sum;
vector<long long> vec;
bool get(long long v) {
  long long dd = 0;
  long long cnt = 0;
  long long zero = 0;
  int f = n / v;
  if (f == 0 || n == v) {
    return true;
  }
  for (int i = 0; i < vec.size(); i++) {
    dd += max(zero, (vec[i] - cnt));
    if ((i + 1) % v == 0) cnt++;
  }
  return (dd >= m);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    sum += arr[i];
    vec.push_back(arr[i]);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  if (sum < m) {
    cout << -1 << endl;
    return 0;
  }
  long long left = 1;
  long long right = n;
  long long search = -1;
  while (right >= left) {
    long long mid = (right + left) / 2;
    if (get(mid)) {
      right = mid - 1;
      search = mid;
    } else {
      left = mid + 1;
    }
  }
  cout << search << endl;
  return 0;
}
