#include <bits/stdc++.h>
using namespace std;
int fx[4] = {1, -1, 0, 0};
int fy[4] = {0, 0, 1, -1};
const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9 + 7;
const int maxn = (int)2e5 + 5;
vector<long long> cost;
long long n, m;
bool check(long long day) {
  long long sum = 0LL;
  long long nibo = n / day;
  long long j = 0;
  for (long long i = 0; i <= nibo; i++) {
    for (long long k = 0; k < day; k++) {
      if (j >= cost.size()) break;
      sum += max(0LL, cost[j] - i * 1LL);
      j++;
    }
  }
  return sum >= m;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  cost.resize(n);
  for (long long i = 0; i < (n); i++) {
    long long x;
    cin >> x;
    cost.push_back(x);
  }
  sort(cost.rbegin(), cost.rend());
  long long l = 1, r = n, ans = -1LL;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (check(mid)) {
      r = mid - 1;
      ans = mid;
    } else
      l = mid + 1;
  }
  cout << ans << endl;
  return 0;
}
