#include <bits/stdc++.h>
using namespace std;
bool solve(int n, int m, vector<long long> v, int days) {
  int idx = 0, cnt = 0;
  long long boi = 0;
  while (idx < n) {
    for (int j = 0; j < days; ++j) {
      if (idx < n) {
        boi += max((long long)0, ((long long)v[idx] - cnt));
        idx++;
      }
    }
    cnt++;
  }
  if (boi >= m) {
    return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<long long> arr(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  sort(arr.begin(), arr.end(), greater<long long>());
  int low = 1, high = n, mid;
  while (low < high) {
    mid = (low + high) / 2;
    if (solve(n, m, arr, mid)) {
      high = mid;
    } else {
      low = mid + 1;
    }
  }
  if (solve(n, m, arr, low)) {
    cout << low << endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}
