#include <bits/stdc++.h>
using namespace std;
long long n, m;
std::vector<long long> v;
long long check(long long x) {
  vector<long long> blah[x];
  long long z = 0;
  for (long long i = 0; i < n; i++) blah[i % x].push_back(v[i]);
  for (long long i = 0; i < x; i++) {
    for (long long j = 0; j < blah[i].size(); j++)
      z += max((long long)0, blah[i][j] - j);
  }
  if (z >= m)
    return 1;
  else
    return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  long long temp;
  long long s = 0;
  for (long long i = 0; i < n; i++) {
    cin >> temp;
    s += temp;
    v.push_back(temp);
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  if (m > s) {
    cout << -1;
    return 0;
  }
  long long ans = 1000000007;
  long long l = 1, r = n;
  while (l <= r) {
    long long mid = l + (r - l) / 2;
    if (check(mid)) {
      ans = min(mid, ans);
      r = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ans;
  return 0;
}
