#include <bits/stdc++.h>
int mod = 1000000000 + 7;
long long int inf = 1000000000000000000;
using namespace std;
mt19937 unlucko(chrono::steady_clock::now().time_since_epoch().count());
int n, k;
vector<int> a;
bool check(int mid) {
  int sum = 0, delta = 0;
  for (int i = 0; i < n; i += mid) {
    for (int j = i; j < min(n, i + mid); j++) {
      sum += a[j] + delta;
      if (sum >= k) return true;
    }
    delta--;
  }
  return false;
}
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  sort(a.rbegin(), a.rend());
  int l = 1, r = n + 1;
  while (l < r) {
    int mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (r != n + 1)
    cout << r;
  else
    cout << -1;
}
